Comparing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Comparing

How can i compare to str by < and>?

9th Jun 2019, 3:39 PM
Lili
Lili - avatar
4 Answers
0
what do you want to compare? the length? or test if a number inside a string is higher than a number in another string? or something else?
9th Jun 2019, 3:47 PM
Cat Sauce
Cat Sauce - avatar
+ 5
The length of 2 strings is easy to compare. a = "hello" b = "out there" if len(a) > len(b): print("a is bigger than b") else: print("b is bigger than a")
9th Jun 2019, 3:57 PM
Lothar
Lothar - avatar
+ 1
the length!
9th Jun 2019, 3:49 PM
Lili
Lili - avatar
0
thanks so much
9th Jun 2019, 3:58 PM
Lili
Lili - avatar