LAB 2-1
Put all of the required functions and function calls into a single file, then upload that file. You do not need to show me output as I will be executing each file myself.
DO NOT USE any features not covered in chapters 1-3! Points will be taken off for doing so!
1. Write a function named powers that has one parameter named num. This function should always produce 11 lines of output, one for the parameter raised to the 0th power through one for the parameter raised to the 10th power.
Call your function three times:
powers(2)
powers(3)
powers(10)
2. Write a function named palindrome that has five parameters, named s1, s2, s3, s4, and s5. This function should be called with five single-char string arguments. palindrome should produce two lines of output, one of the parameters in order from left to right, and one of the parameters in order from right to left, so that a quick visual inspection will reveal whether the parameter is a palindrome or not. (A palindrome is a word that is spelled the same forwards as backwards.)
Call your function three times:
palindrome('l','e','v','e','l')
palindrome('r','e','f','e','r')
palindrome('s','y','r','u','p')
3. Write a function named miles_converter that has one parameter, named miles. This function should produce one line of output, showing the number of yards, feet, and inches represented by miles.
Call your function once:
miles_converter(3.4)
Below is the output from my solution to this Lab.
>>>
RESTART: /Users/mamp/Desktop/Desktop - iMac/DEANZA/WINTER-2020/INDIVIDUAL-LABS/LAB-2/lab2.py
powers
1
2
4
8
16
32
64
128
256
512
1024
1
3
9
27
81
243
729
2187
6561
19683
59049
1
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
10000000000
palindrome
level
level
refer
refer
syrup
purys
miles_converter
3.4 miles = 5984.0 yards, 17952.0 feet 215424.0 inches
>>>
LAB 2-2