-
Notifications
You must be signed in to change notification settings - Fork 0
/
true_or_false.py
24 lines (21 loc) · 1.01 KB
/
true_or_false.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'''🚀 Fun with String comparison in Python
'''
# 💎 Guess the output of this code
print("8" > "11") # 👩💻Output: True
print("Two" > "Three") # 👩💻Output: True
print("Four" < "One") # 👩💻Output: True
print("hello" == "HELLO") # 👩💻Output: False
print("😀" > "😉") # 👩💻Output: False
################################################
# 💎 Can you guess the reason behind this unusual behavior
# 💎 You need to understand the UNICODE value of each character
print(ord('8')) # 👩💻Output: 56
print(ord('1')) # 👩💻Output: 49
print(ord('w')) # 👩💻Output: 119
print(ord('h')) # 👩💻Output: 104
# Python compare two strings in the order of their unicode values.
# You can check the unicode values of other characters to get the
# answers of all the print statements given above.
#####################################################
# 🎯 @CodingMantras
# See you soon, till then Keep Improving 🤝!!!