xxxxxxxxxx
a_int = 24
#this is a int
a_float = 3.2883
#this is a float. you can see that it has a difference. it has a . :)
xxxxxxxxxx
string = "3.5"
#integer = int(string) will not work, as that returns an error.
integer = int(float(string)) #This will work, as you first turn "3.5" to 3.5
#then make it the integer 3
xxxxxxxxxx
#this is a int
the_int = 41
#this is a float
the_float = 3.937266272812163518356278
xxxxxxxxxx
def aud_brl(amount, From, to):
ER = 0.42108
if From.strip() == 'aud' and to.strip() == 'brl':
result = amount/ER
elif From.strip() == 'brl' and to.strip() == 'aud':
result = amount*ER
print(result)
def question():
amount = float(input("Amount: "))
From = input("From: ")
to = input("To: ")
if (From == 'aud' or From == 'brl') and (to == 'aud' or to == 'brl'):
aud_brl(amount, From, to)
question()
xxxxxxxxxx
Command: float()
What is float: Float Conversion Function
Description: The float() function converts a given value to a floating-point number data type.
Example: floating_number = float("42.5") will convert the string "42.5" to the float 42.5.