Python Forum
how to assign variables?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to assign variables?
#1
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
Reply
#2
rather than this
num1+num2=num4
the variable you are assigning a value to goes first like this
num4 = num1 + num2
Reply
#3
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)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020