+ 1
Why the below code prints "fatcat" and what bool is doing ?both variables have same length of characters why cat1 is greater ?
cat_1 = "CatF" cat_2 = "CatD" bool = cat_1>cat_2 if bool == True: print("fatcat") else: print ("deadcat")
7 Réponses
+ 1
Guess that's the fault of that challenge. ;)
+ 6
Because:
ord('F') > ord('D')
☺️🤔🤕
+ 4
Also, never use bool, int, str etc. as variable names 😤
+ 3
It goes by the order of the letters in the alphabet (simply put). Every pair of letters is compared until one higher is found, and f is higher than d.
For knowing more about the order of letters, check out the ASCII and unicode tables.
+ 1
Vishal Gaikwad, sorry, I haven't looked into pygame at all yet!
0
HonFu how can I contact you??
I have some error in my program(pygame example) and I don't know what's wrong with the code
I have spent 2 days to Debug I don't what to do
0
HonFu Ok
But do you know anything about this error
AttributeError : 'builtin_function_or_method' object has no attribute 'bottom'