Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the python Part 1: Use input and int functions to get a count value, from the user that is running the program. Create a

Use the python
Part 1:
Use input and int functions to get a count value, from the user that is running the program.
Create a for loop that uses the range() function. The loop should iterate the number of times
that the user entered.
Inside the loop, add a statement to print one asterisk and not break to the next line ( end='' ).
Run the program. You should see a single line of asterisks. The number of asterisks should equal the
number entered by the user.
From here on down, the loop in Part 1 will be referenced as the InnerLoop.
Part 2:
Build a second for loop to execute the loop (InnerLoop), that you completed in Part 1, multiple
times. This new loop is the OuterLoop. This loop should use the range() function to iterate through
rows of asterisks. The number rows should equal the count entered by the user.
At this point, when a 5 is entered, the output should look like:
*****
*****
*****
*****
*****
Part 3:
To get the O in the center ... The best solutions, that I have thought of, will replace the statement, in Part 2, that prints the asterisk. It will replace that one statement with an if/else structure to print an O in the center, or print an asterisk otherwise.
The center can be determined by the row being equal to the midpoint and the column being equal to the midpoint. The midpoint can be calculated as: mid = count // 2
Because the one asterisk should be in the middle, using odd numbers for the number of asterisks across, and the number of asterisks down, works better.
The final output, when a 5 is entered, should look like:
*****
*****
**O**
*****
*****

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions