Python allows for user input. That means we are able to ask the user for input. input()=To take input from user.
Example=
val=input("Message")name=input("Enetr Yourname :")
print(name)Formatting Output
name=input("Enetr Yourname :")
print("Good Evening {}".format(name))val1=input("Enter val1:")
val2=input("Enter val2:")
sum=val1+val2
print(sum)Type Casting is the method to convert the variable data type into a certain data type in order to the operation required to be performed by users.
Example=
val1=int(input("Enter val1:"))
val2=int(input("Enter val2:"))
sum=val1+val2
print(sum)val1=(input("Enter val1:"))
val2=(input("Enter val2:"))
sum=int(val1) + int(val2)
print(sum)Formatting Output
val1=(input("Enter val1:"))
val2=(input("Enter val2:"))
sum=int(val1) + int(val2)
print("sum of {} and {} is {}".format(val1,val2,sum))1️⃣Write a program to calculate bill when
rateandquantityis given by user.
💡 HINT: use formula bill = rate * quantity, take input for rate and quantity from user.
👁 Show Answer
val1=(input("Enter Rate:"))
val2=(input("Enter quantity:"))
bill=int(val1)*int(var2)
print("sum of {} and {} is {}".format(val1,val2,bill))
