Community post
learning Python 3 diary#3
Dear Diary,
I've caught a cold couple of days ago and it has progressed and bloomed into a light fever. Being unable to think properly I have resigned to reading and mostly sleeping.
I feel a lot better so have restarted on my learning to code journey ^^
Today on the menu are Conditionals :D
Finally!!!
sick = input("Are you sick? ")
if sick.startswith("y"):
print("Go home and rest!")
else:
pass
if sick.startswith("n"):
print("Get ready for some Pizza!")
else:
print("let's do Pizza next time")
It feels like learning ABC at the moment :D
Especially since it's easy to find loopholes 🤔
Like in this exercise, if I enter two words instead of one the second part isn't executed.

I suppose space somehow interferes with the second part and there are more things needed to make it run even if i enter "lol lol lol" :D
~Anmitsu
Replies (7)
Hey @anmitsu. Good work on learning those conditionals ^_^ Here are some tips.
-
-
-
I hope you are able to kick that cold and feel better soon!elseclauses aren't mandatory, so if yours only containspass, you are fine just leaving it out completely.if you have a conditional you only want to test if the previous condition fails, you can use
elif. For example:You are sort of correct that the space is "interfering" with the second part, but you're incorrect that it is not executing. Space is not considered alphabetic, so any string with a space will return
False. For example,"lol lol".isalpha()returnsFalse;"lollol".isalpha(), however, would returnTrue. So your input is just failing the second conditional test you were expecting to pass.If you were to replace that second conditional with...
...it should work as intended.
You got a 1.70% upvote from @ocdb courtesy of @acidyo!
@ocdb is a non-profit bidbot for whitelisted Steemians, check our website https://thegoodwhales.io/ for the whitelist, queue and delegation info. Join our Discord channel for more information
If you like what @ocd does, consider voting for our witness through SteemConnect or on Steemit Witnesses
Congratulations @anmitsu! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word
STOPTo support your work, I also upvoted your post!
Do not miss the last post from @steemitboard:
Thank you, I learned something because of you. Get well soon.
Space isn't considered alphabetic and has its own Boolean test!!! now it makes sense :O
Now I have to know what space is considered to be... i guess it's space.... thanks @lemony-cricket, you've provided me with some more inspiration :)
thanks for the comment @sereze :)
Python is really exciting to learn. Are you learning anything?
Yes, I am also learning python @anmitsu