Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6.2) Write a program that can repeat the above diagram for x number of rows. Ask user to input an integer x by asking Please

image text in transcribedimage text in transcribedimage text in transcribed
6.2) Write a program that can repeat the above diagram for x number of rows. Ask user to input an integer x by asking "Please input the number of rows you want: ", and your program will print x number of rows. For example, if user input 10, the output shall look like the following: Please input the number of rows you want: 5 * ##1## $$$$$$$ * ##1## Please input the number of rows you want: 10 * ##1## $$$$$$$ * ##1## $$$$$$$ * #### $$$$$$$ * 6. Use the elements in the two lists below to generate each output: In [ ]: 1 a = ['*', '#', '$'] 2 b = [1, 4,7] 6.1) Write one print function to generate this output graph: (list a is the symbol; list b is the quantity) * #### $$$ $ $ $ $ In [20] : 1 a = ['*', '#', '$' ] b = [1, 4,7] def question_6_1( ) : 4 5 # YOUR CODE HERE print (a [0]*b [0]+"\ "+a[1]*b[1]+"\ "+a [2]*b [2] ) In [21] : ### test your answer 2 question_6_1( ) $$$$$$$6.3) In order to prevent a user from inputting a very large number, which will take too much system resources to print, you need to modify the above code, so that it will print a max of 20 lines, and stop printing at line 21, and give a message: "The system will only print the first 20 lines that you requested..." Please input the number of rows you want: 21 * ##1## $$$$$$$ * ##1## $$$$$$$ * ##1## $$$$$$$ * ##1## $$$$$$$ * ##1## $$$$$$$ * ##1## $$$$$$$ * ##1## The system will only print the first 20 'Lines that you requested... In [ ]: ['*'.'#'.'$'] [1.4.7] 0'9! def question_6_3(): # YOUR CODE HERE raise NotImplementedError() O'U'lthIl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions