84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
#Aren’t word and key equal? Why not perform the print operation and jump directly to the superposition of i?
You can’t tell the reason just by taking screenshots of these contents. You can add a print in else, firstly to see if else is entered, but also to see what the word and key are.
What you see in the debuger of IDE may not be the real values. You can print out their type and have a look. You will find that debuger can sometimes lie. Also, you can look at the difference between __str__ and __repr__ and understand obj==eval(repr(obj)). Here’s a great answer: Difference between str and repr in Python
debuger
IDE
__str__
__repr__
obj==eval(repr(obj))
Just use == to judge. . .
==
Print it out to see if there are any encoding problems in the local and Linux environments. After pasting down the code, do you want us to type it again by hand? . .
You can’t tell the reason just by taking screenshots of these contents.
You can add a print in else, firstly to see if else is entered, but also to see what the word and key are.
What you see in the
debuger
ofIDE
may not be the real values. You can print out their type and have a look.You will find that
debuger
can sometimes lie.Also, you can look at the difference between
__str__
and__repr__
and understandobj==eval(repr(obj))
.Here’s a great answer: Difference between str and repr in Python
Just use
==
to judge. . .Print it out to see if there are any encoding problems in the local and Linux environments. After pasting down the code, do you want us to type it again by hand? . .