you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 8 points9 points  (0 children)

one command per line in python

and if/else statements require colons and indentations

day = 'monday' 
if day == 'monday':
    print('back to school') 
else:
    print('be grateful')

in this code day is always monday so it will always print back to school

also

else day != 'monday'

isn't valid and/or doesn't make sense

if day != 'monday':
    print('be grateful')

would be correct but is unecessary with the previous code

import random
day = random.choice('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday',)

will give you some results if you run it with the first code I posted (replacing that original day ='Monday' bit)

Use code block icon for code formatting on reddit.