Question: Implement the following 5 functions. For this problem you are not allowed to use string multiplication. So, statements such as print(symbol * i) or my_string
Implement the following 5 functions. For this problem you are not allowed to use string multiplication. So, statements such as print(symbol * i) or my_string = symbol * i are NOT allowed. This is python3 using Visual Studio Code.
(e) Write a function printHills() that takes three parameters, num (int), symbol1 (string), and symbol2 (string), and prints num two-symbol "hills", where each hill is larger than the last. For example printHills(4,"H","!") should produce the following: H I - I ! H HH !! ! . HH HHH !! ! H HH HHH HHHH ! ! ! Il as the second parameter. Hint 1: To avoid Python creating a new line after a print statement you can use end = For example print(5, end =""). Hint 2: In order to use functions that are defined in the same file you call them without using dot notation (i.e., printUpTriangle (4) instead of lab04_prob2.printUpTriangle(4)). For parts (b)-(e) it will be very helpful to call functions you wrote in previous parts! Hint 3: If you have a for loop (e.g., for i in range ... ) and you are not using the loop variable (e.g., i) somewhere else in your code you will get a unused variable style error. You can fix this by having your loop variable name start with an underscore (e.g., _i)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
