print("enter start() to start the program")
def start():
print("This script converts GBP into any currency based on the exchange rate...")
print(" ") #enters a line
exchangeRate = int(input("Enter the exchange rate (Eg: 0.80)"))
print("how much would you like to convert???")
gpb = int(input())
print(gpb*exchangeRate)
If I put the exchange-rate at 0.81 and I enter £1 it always returns 0.
Use
float()instead ofint()with yourinput()call. I.e.,otherwise if the user enters
0.81,int()will truncate this to0during the conversion.By using
float()you’ll keep the decimal value supplied as input and your computation should yield the result you expect.