Informatics Practices
Write a function that takes amount in dollars and performs dollar-to-rupee price conversion; it then displays the amount converted to rupees.
Answer
def convert_dollars_to_rupees(amount_in_dollars, conversion_rate):
amount_in_rupees = amount_in_dollars * conversion_rate
return amount_in_rupees
amount = float(input("Enter amount in dollars "))
conversion_rate = float(input("Enter conversion rate "))
converted_amount = convert_dollars_to_rupees(amount, conversion_rate)
print("Converted amount:", converted_amount)Output
Enter amount in dollars 55
Enter conversion rate 82
Converted amount: 4510.0
Related Questions
Write a function called calculate_area() that takes base and height as input arguments and returns area of a triangle as an output. The formula used is: Triangle Area = 1⁄2 * base * height
Modify the above function to take a third parameter called shape type. Shape type should be either triangle or rectangle. Based on the shape, it should calculate the area.
Formula used: Rectangle Area = length * widthWhat would the following code do?
a = b = 70What is the error in the following code?
z, p = 6