+ 1

Need help in python question in description plz help

I need to write a program which takes input 1+1 2+2 - 2*-2 2/-2 directly from user and does arithmetic operation with it

20th Mar 2021, 4:19 AM
Rohan Raj Shrestha
Rohan Raj Shrestha - avatar
6 ответов
+ 2
Use eval(input())
20th Mar 2021, 4:39 AM
TOLUENE
TOLUENE - avatar
+ 1
hi! at what stage of writing code are you stuck? could you show us your code?
20th Mar 2021, 4:40 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
eval() evaluates expression on strings. if user enters "2+2" string eval() will do arithmetic operation on the string.
20th Mar 2021, 5:40 AM
TOLUENE
TOLUENE - avatar
0
I really don't have any idea.. What does eval do?
20th Mar 2021, 4:58 AM
Rohan Raj Shrestha
Rohan Raj Shrestha - avatar
0
Can I dm you?
20th Mar 2021, 4:59 AM
Rohan Raj Shrestha
Rohan Raj Shrestha - avatar
0
Md Sayed Ohh now I know thank you😊😊
20th Mar 2021, 5:47 AM
Rohan Raj Shrestha
Rohan Raj Shrestha - avatar