0

Greater than / Smaller than Operators

Q1. Any one explains on this? ---------------- print ('a' > 'b') print ('Bob' > 'Dave') False False ----------------- Why is False here? Does it mean that 'Strings cannot be compared'? ------------------- ------------------- Q2. How to understand the concept 'Control Flow'?

25th Aug 2022, 3:48 PM
Philmocoucou
Philmocoucou - avatar
6 ответов
+ 5
Coucou MO ASCII value of a is less than b ASCII value of B is less than D Comparing ASCII value of first character
25th Aug 2022, 3:58 PM
A͢J
A͢J - avatar
+ 4
Strings are compared lexiographically.. 1) 'a' > 'b' false because 'a' ascii value is 97. For 'b' is 98 So 97>98 false. and 'Bob' > 'Dave' false because 'B' > 'D' => 66 > 68 false. When equal only then go on compare next character... And repeated until end. 'ab' > 'aa' returns true because 'a' and 'a' equal, and next 'b' > 'a' is true.
25th Aug 2022, 4:03 PM
Jayakrishna 🇮🇳
+ 3
Coucou MO ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or '@' or an action of some sort. https://www.asciitable.com/
25th Aug 2022, 5:47 PM
Chris Coder
Chris Coder - avatar
0
What does 'ASCII' mean? I am learning Python without any previous knowledge...
25th Aug 2022, 4:11 PM
Philmocoucou
Philmocoucou - avatar
0
Thank you for all the answers below the post! Very helpful!
25th Aug 2022, 6:07 PM
Philmocoucou
Philmocoucou - avatar