How to check strings with if else ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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")

11th Feb 2019, 1:30 PM
Phyoe Min Thant
Phyoe Min Thant - avatar
1 Answer
+ 2
If you need some advanced string checks, use Regular Expression (re), but some simple string checks can be done with basic string methods.
23rd Feb 2019, 10:21 AM
Seb TheS
Seb TheS - avatar