+ 2

Getting the TypeError: bad operand type for unary +: ‘str’

Here is the code: height = input(“How tall are you? “) print( + height + “ is a perfectly good height to be! I am 6 feet tall!!”)

6th Nov 2021, 2:19 PM
Caitlin Cook
Caitlin Cook - avatar
4 Antworten
+ 2
There is an extra '+' inside the print function. The correct code should be like the following code snippet height = input("How tall are you? " ) print( height + " is a perfectly good height to be! I am 6 feet tall!!") And there was some weird symbol used in place of ". Maybe it's because you copy-pasted this from some where else.
6th Nov 2021, 2:23 PM
Rishi
Rishi - avatar
+ 1
Oooooo!! Thank you!!!
6th Nov 2021, 2:25 PM
Caitlin Cook
Caitlin Cook - avatar
+ 1
That did work thank you!!!
6th Nov 2021, 3:12 PM
Caitlin Cook
Caitlin Cook - avatar
+ 1
Caitlin Cook Happy to help =)
6th Nov 2021, 4:02 PM
Rishi
Rishi - avatar