Write a function that takes amount in dollars and dollars to rupees conversion price it then returns the amount converted into ruppees python
Answers
Answer:
Function to convert dollars to rupees:
def dollars_to_rupees():
dollar = float(input("Please enter dollars:")) // Input
rupees = dollars * 64 // conversion logic
print(rupees, " Rupees") // print the result
This is a basic function to convert dollars to rupees. Here dollar is a variable name that will store the value which is given by the user.
rupees = dollars * 64 this line shows that, the actual conversion logic.
and lastly, print() function print the final result.
Answer:
#definition of the function
def dollar_to_rupee(amount,price):
rs=amount*price
return rs
#main program
am=float(input("Enter the amount is dollars:"))
pr=float(input("Enter the dollar to rupee conversion price:"))
rupee=dollar_to_rupee(am,pr)
print("Amount converted in rupees is= Rs.",rupee)
Explanation: