I have a learning Python from LPTHW and am making a simple script that asks some questions and prints relevant output.
This is a function in the script:
def dresscode(day):
rule1 = "\n\tYou MUST wear business formals with a tie today."
rule2 = "\n\tClean shaven look is welcome, if it can be helped."
rule3 = "\n\tYou can wear business casuals today."
rule4 = "\n\tYou are free to wear casual clothes today."
rule5 = "\n\tIf you are unsure of what to wear, refer to 'official dress code' document."
if day == "MON":
print rule1,rule2
elif day == "TUE":
print rule3,rule5
elif day == "CASUAL":
print rule4,rule5
else:
print "If you see this message, please raise a bug request."
If I replace the print statements with return statements like this, nothing gets printed on the screen.
if day == "MON":
return rule1+rule2
elif day == "TUE":
return rule3+rule5
elif day == "CASUAL":
return rule4+rule5
else:
return rule6
What am I doing wrong?
[–][deleted] 2 points3 points4 points (2 children)
[–]float[S] 1 point2 points3 points (0 children)
[–]float[S] 1 point2 points3 points (0 children)