Python Forum
how to assign variables? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: how to assign variables? (/thread-16634.html)



how to assign variables? - RY8 - Mar-07-2019

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


RE: Help - Yoriz - Mar-08-2019

rather than this
num1+num2=num4
the variable you are assigning a value to goes first like this
num4 = num1 + num2



RE: how to assign variables? - saravanatn - Mar-09-2019

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)