Python Forum

Full Version: how to assign variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My code
num1=float(input("Please enter A number"))
num2=float(input("Please enter another number"))
num3=float(input("Please enter another number"))
num1+num2=num4
print(num4)
Sum*num3=total
what I need to do:

Read 3 numbers as input
Add the first 2 numbers
Multiply the result by the third number
Output the final result if it is greater than 100
Otherwise output the first number


I have no clue what I am doing Wall
rather than this
num1+num2=num4
the variable you are assigning a value to goes first like this
num4 = num1 + num2
I think below code is what you looking for
num1=float(input("Please enter A number"))
num2=float(input("Please enter another number"))
num3=float(input("Please enter another number"))
if ((num1+num2)*num3 >100):
    print('calculation value ',(num1+num2)*num3)
else:
    print('number 1 ',num1)