Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve the code as specified by the instruction in the questions, there are three parts to one code, and please post 3 different python

Please solve the code as specified by the instruction in the questions, there are three parts to one code, and please post 3 different python files: starLine.py, leftTriangle.py, rightTriangle.py. Also, if possible post copyable code, a screenshot of the source file with comments and the output file. Thank you. Also, these are not 3 different questions, they are multi-part questions and in accordance with Chegg policy, as each of the slides say "modify" the previous code, so solve all three.

image text in transcribedimage text in transcribedimage text in transcribed

We are going to play will creating a type of art today called ASCII art. This type of computer url consists of arranging printable characters on the screen in an artistic form. (Think of creating art and shapes on the screen before modern graphics cards.) The first shape we make today is a simple row of stars. Write a program that you will save in a file called starline.py. This program should: Ask the user for a non-negative integer, which is the total number of stars If the number is invalid, keep prompting the user until a valid number is given . Print out the total number of stars in a row, where each star is seperated by a single space You must use a loop! (Do not use string multiplication.) For example: Please input a positive number: 0 Please input a positive number: -1 Please input a positive number: 5 * * * * * Note: Your code needs to have the following line in it somewhere: print("*", end='') (This line will print one star at a time, followed by a space. It also allows the next print to start on the same line.) Note 2: You cannot use string manipulation to get your stars -- you must practice looping and printing one star at a time in this lab. So, this mean I will not accept the following code in any activity or any permutation of this code whicre you usc multiplication to print your stars: print (num * Note 3: While you might be tempted to use a while loop, a for loop is actually casier in the long run.... Save this code as starLine.py and upload it into eLearning: Log into cLearning . Go to this class . Click on the "Lab Submission" link on the left menu . Click on the "Lab05" folder Upload the files to their proper locations. Modify your previous code to use nested loops so that it prints out mulitple lines of stars, which happen to look like a left-justified right triangle! Write a loop around your previous loop code to run it multiple times with different numbers of stars. Your code should prompt for a positive height, and re-prompt if a positive number was not entered. For example: Please input a positive height: -8 Please input a positive height: 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hint 1: The height is the number of times the outer loop should run. Hint 2: The inner loop prints out one line of stars, starting with one star on the first line and incrementing the number of stars by one each time it runs. Save this code as left Triangle.py and upload it into eLearning: Log into eLearning Go to this class . Click on the "Lab Submission" link on the left menu Click on the "Lab05" folder Upload the files to their proper locations. In Activity C, you printed out a left-justified right triangle. Now I want you to think about writing a right-justified right triangle! For example: Please input a positive height: 5 + + + + + + + + + + + + Each line is actually a mixture of spaces and stars. [Q3] How does the height of the triangle relate to the number of spaces and stars printed the first line? On the second line? Save this code as right Triangle.py and upload it into eLearning: Log into eLearning Go to this class Click on the "Lab Submission" link on the left menu Click on the "Lab05" folder Upload the files to their proper locations. [SIG3] Please show rightTriangle.py to an instructor

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions