+ 1
When would you ever have to compare strings?
For example: "abc" < "def"
4 Respuestas
+ 6
oh idk maybe never lol
+ 3
maybe you ask the user for input and if he enter "hey" you Will print hey otherwise bye or idk
user = input()
if user == "hey":
print("Hello!")
else:
print("I dont understand you")
+ 1
I mean like when would you have to use > or < when comparing strings
0
This is called Lexicographic ordering and based on what I gathered, it's handy when you are trying to make a dictionary aka alphabetical ordering for a set of characters etc.... I've seen a Harvard student use it to write a code for an AI to play Super Mario! and it also has several Wikipedia pages if you're interested to read more about it!