+ 1
Please, how do I create the simple calculator task on Pyton?
I don't know what I'm doing wrong, somebody should please help with the code for the simple calculator, here's my code int1 = int(3)# your code goes here int2 = int(6)# your code goes here sum = int1 + int2 print(sum)
30 Answers
+ 4
print("--- Welcome to py Calculator ---")
print(f"{eval(input())}")
this is the simplest calculator, a one line calculator
+ 2
David Michael ,
can you please give us the tutorial name, the lesson / exercise name or number (assuming that you are talking about a code coach exercise)
otherwise we need a more precise task description.
thanks!
+ 2
You don't need to pass any argument to input() in code coach.. According to description, just ouput what is asked, no extra or less.
just try this way : David Michael
int1 = int(input())
int2 = int(input())
print( int1+int2 )
+ 1
your code?
+ 1
Shourya Pandey ,
i don't know if you have misunderstood the question. but the code in your post is completely wrong. we are talking about python.
may be you can correct your code, or otherwise please remove it.
thanks!
+ 1
a = 1
b = 3
c = a,b
print(sum(c))
+ 1
Liberian AG where's the code you've written so far
+ 1
Liberian AG Write your code and share it here, let's help you identify the error.
+ 1
David Michael here's it
#your code goes here
weight = int(input())
height = float(input())
x = weight /float(height * height / 100)
if x < 18.5:
print ('Underweight')
if 18.5 >= x < 25:
print ('Normal')
if 25 >= x < 30:
print ('Overweight')
if x >= 30:
print ('Obesity')
+ 1
Liberian AG
Consider using the elif function
+ 1
+ 1
"""
off topic to OP
Liberian AG
you can use your own thread , instead posting here..
according to task this is what you need. See comments to know about changes...
@David Michael
your code missing some value what in is 20 for example.. So. Hope it helps..
"""
#your code goes here
weight = int(input())
height = float(input())
x = weight /height * height # √
if x < 18.5:
print ('Underweight')
elif 18.5 <= x < 25: # use <= instead of >=
print ('Normal')
elif 25 <= x < 30:
print ('Overweight')
elif x >= 30:
print ('Obesity')
+ 1
i1 = int(input("Enter First Number : ") )
i2 = int(input(" Enter Second Number: ") )
print( i1 + i2 )
0
pls Show your attempt here....
0
int1 = int(3) is same as int1 = 3.
You need to assign them as input variables instead.
0
David Michael May you need to take input there..
Use this :
int1 = int( input() ) # it takes input and convert to integer type. Do the same for int2 and remianing works well in your code..
int1 = int( input() )
int2 = int( input() )
print( int1 + int2 )
0
The exercise name is 17 coach exercise, the simple calculator exercise
0
David Michael
What's you update code? What changes you tried from the posts..?
You can see your solution already above..
0
# This is my update code, still not working, I thnking something is not right from the input line
int1 = int( input(6) ) # it takes input and convert to integer type. Do the same for int2 and remianing works well in your code..
int2 = int( input(3) )
print( int1 + int2)
0
I did this, still not correct