+ 1
How to check strings with if else ?
friend = "Maung Maung" if friend == "MaungMaung": print("Welcome Sir From My VIP Room") else: print("Welcome Sir From My Coffee Shop")
10 Answers
+ 2
Use indentation.
if friend == "MaungMaung":
print("VIP Room")
else:
print("Coffee Shop")
+ 1
Oh I see. I need format. It is alright now. That's why.
+ 1
Thank you very much. It takes me a day to work out.
0
On my laptop, there is an error pop up "expected an indented block". Why?
0
Nope. I put it right and it is still showing.
0
Try with this.
friend = "Maung Maung"
if friend == "Maung Maung":
print("Welcome Sir From My VIP Room")
else:
print("Welcome Sir From My Coffee Shop")
Maybe your IDE doesn't allow spaces to indent.
If it doesn't work please share a link to your code.
0
The code you shared is like the one you originally had, which needs to be indented.
0
indented? How shall I do?