Calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculator

How to make a calculator that takes multiple numbers and operators and parentheses? If we give this expression as an example, (2 * 3) + 4 ** 2 will print the output

16th Dec 2023, 1:46 PM
Claire
Claire - avatar
6 Answers
+ 6
Fereshte a really lengthy equation input type can be created in one line print(eval(input()))
16th Dec 2023, 4:50 PM
BroFar
BroFar - avatar
+ 5
Fereshte what have you tried so far ? I see you have completed the "Python For Beginners" course ..
16th Dec 2023, 3:37 PM
BroFar
BroFar - avatar
+ 1
من فضلك لا ترسل بريدا عشوائيا إلى منتدى الأسئلة والأجوبة ادم محمد الصالح التحذير الثاني
17th Dec 2023, 7:49 PM
BroFar
BroFar - avatar
0
Yes but I can just create a calculator with 2 numbers but for more I have no idea😣
16th Dec 2023, 4:00 PM
Claire
Claire - avatar
0
I know it but it is a project! I can't use it
16th Dec 2023, 7:32 PM
Claire
Claire - avatar
0
Do it like you would do in real life. What comes first and so on. Get input from the user. Split the string into terms and sort them in priority.
16th Dec 2023, 8:02 PM
Stefanoo
Stefanoo - avatar