Что значит? TypeError: unsupported operand type (s) for -: 'str' and 'str' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Что значит? TypeError: unsupported operand type (s) for -: 'str' and 'str'

Пожалуйста объясните...

18th Jul 2020, 8:28 PM
Makhsudov_27
Makhsudov_27 - avatar
5 Answers
18th Jul 2020, 11:48 PM
Makhsudov_27
Makhsudov_27 - avatar
+ 1
Please add your code on playground and provide the link. Sounds if you were trying to do something with a string, what's not allowed, like e.g. using operand < or >, but one can only help you, if you provide the code or at least the affected lines.
18th Jul 2020, 10:01 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Yay, now I can see it 🙃 I used the following sample input (+ , -, * and / already worked properly): ++ 1 1 tugadi And the compiler said there was a missing cast in line 44: print("1-son + 2-son = " + str(result1)) Your result1 variable was of type float. If you're about to concatenate variables into messages to print, you need to cast them, if they're of different types.
19th Jul 2020, 12:24 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Thank you 😊😊
19th Jul 2020, 6:55 AM
Makhsudov_27
Makhsudov_27 - avatar
0
I use PyCharm
18th Jul 2020, 11:50 PM
Makhsudov_27
Makhsudov_27 - avatar