Back-To-School Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Function basics
6. Functions with multiple parameters
Summary

Instruction

Good! Our previous function only had one parameter, but you can use as many of them as you wish:

def print_between(lower, upper):
  for i in range (lower, upper+1):
    print('Current value:', i)

The function above takes two arguments: lower and upper, and prints

Current value {x}

replacing {x} with all numbers from lower to upper (inclusive).

Exercise

Write a simple currency conversion function named convert that takes two arguments – amount and rate – and prints the following (on one line):

Amount: {amount} Rate: {rate} Conversion: {amount*rate}

Invoke the newly created function with amount = 55 and rate = 1.75.

Stuck? Here's a hint!

Inside the function, simply use print().