how do you end a block in python? For example, x=4 if x<4: print '4' print '4' will give me a synthax error for the 4th line. And how do you write everything in one section(?) w/o executing the program? Thx!!
never mine noticed that i aven't opened the editors window :p
*mind
python uses the indentation for syntax. So, if you're getting an error on your fourth line, I'd guess it's because you need to indent your third line four spaces (it looks like it's only one space, but that might just be the way things post here when you ask a question.)
Yeah as TomDeBeauchamp said, try putting indentation on the third line. The standard is either 4 spaces or one tab (basically the same). Or maybe if you have Python 3 or later print is no longer a statement but a function. So you would have to write: print(4) Or if you want to write it as a string: print('4')
1. Open new window 2. Indent by pressing tab
indentation matters in python... your code will work this way i think x=4 y=6 if x<y: print x, 'is least' print x
Join our real-time social learning platform and learn together with your friends!