Today's record is a bit late, not because I was lazy and didn't study. It's because I've been studying if and else for 7 days, and I wanted to ask chatgpt to help me review, but the questions it asked were always beyond the scope. I think it must be because I asked the wrong questions, after all, how can a machine be wrong!
Record
- Today, I learned about nested if statements, where each if statement within the nesting will be executed. However, elif statements are only executed when the previous if statement's condition is false.
- Indentation is important in Python. Indentation is required for if statements. But nowadays, most editors support automatic code formatting, right? Maybe I won't need to pay attention to this issue once I become more experienced.
CODE
print("👮♂️ Fake Fan Finder 👀")
game = input("what's your favourite game? ")
if game == "Genshin Impact":
name = input("Oh really?! Name me any of the characters? ")
if name == "Hu Tao":
work = input("where does Hu Tao work? ")
if work == "Wangsheng Funeral Parlor":
print("You're a true fan")
else:
print("You're a fake fan")
elif game == "Arena of Valor":
print("You're a true man in 5 seconds")
else:
print("You play a niche game!")