555 Posted January 25, 2010 Share Posted January 25, 2010 I am reading an online tutorial and it gives this example.. #!/usr/bin/python var1 = 100 if var1: print "1 - Got a true expression value" print var1 var2 = 0 if var2: print "2 - Got a true expression value" print var2 print "Good bye!" I am guessing #whatever.. is used to comment in python? so #!/usr/bin/python just is telling me that it is a python script? and it says the result of this code will output to the screen 1 - Got a true expression value 100 Good bye! why would it not output 1 - Got a true expression value 100 2 - Got a true expression value 0 Good bye! source link: http://www.tutorialspoint.com/python/python_if_else.htm another question.. the elif command, so is it pretty much the same as an if/else command but backwords else/if "elif"? used to make code shorter? also im guessing python counts from 0? thanks..! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.