+ 1

I have a problem trying to execute if statements in my calculator project

https://sololearn.com/compiler-playground/ccm2PRh16J3l/?ref=app

9th Jul 2024, 4:33 PM
TREVOR NGATHO
TREVOR NGATHO - avatar
7 ответов
+ 3
answer=print(input("What shape is here")) Print the content of "answer". What do you observe? print() does not have a return value. Hence, "answer" will be None, no matter what you enter. input() always returns a string. So when you enter "2.3", it will be a string, not a number. You need to convert the input to a numeric value. The same 2 things apply to the other parts of your program. Also, mind that sololearn Python playground is not interactive. You need to input all values in the beginning of the program – separated by line breaks. Read the small test in the pop-up window.
9th Jul 2024, 4:39 PM
Lisa
Lisa - avatar
+ 1
Yeah Lisa is correct You should not put input() inside print() Other suggestions I would like to add are Surface area for sphere is 4πr² Not 4πr³ And pi value is 3.14159... Not 3.1428 Hope it helps you ✨
9th Jul 2024, 5:49 PM
Hacker Badshah
Hacker Badshah - avatar
+ 1
Thank you for your suggestions❤️❤️But I'm still wondering how I'll get to involve the user🤔What if I put and 'int' after input inside the print😅 I mean..won't it work?
11th Jul 2024, 12:24 PM
TREVOR NGATHO
TREVOR NGATHO - avatar
+ 1
Thanks again😌
17th Jul 2024, 7:54 AM
TREVOR NGATHO
TREVOR NGATHO - avatar
0
Hacker Badshah ,Lisa thanks so much😌❤️I'm still on it I want to also add BMI and even step count😂🔥
17th Jul 2024, 7:56 AM
TREVOR NGATHO
TREVOR NGATHO - avatar