LogFAQs > #955546114

LurkerFAQs, Active DB, DB1, DB2, DB3, DB4, DB5, DB6, DB7, Database 8 ( 02.18.2021-09-28-2021 ), DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicITT: Learning Python
1337toothbrush
06/28/21 11:43:31 PM
#24:


First line makes a call to input() which takes a string that you want to display to the terminal and returns what the user enters into the terminal. That gets assigned to the variable characteristic.

You input "light" so now characteristic == "light". It hits the line --if characteristic == "light":-- which resolves to true, because that is what the variable is holding. However, you make a call to the print() function. print() takes in a string and writes it out to the terminal. So the next output you see is "exemplary individual".

Finally it gets out of the if-block and hits the next print statement: --print("You look like a " + characteristic)--
Remember that characteristic is still holding the value "light", which is why it prints out "You look like a light".

Instead of --print("exemplary individual")-- you should be assigning the string "exemplary individual" to a variable. The quick fix would be to reassign characteristic to that value. So replace your print statements e.g.:

print("exemplary individual") instead becomes: characteristic = "exemplary individual"

---
... Copied to Clipboard!
Topic List
Page List: 1