Question
Using python programming and while loops. Create a program that will output a counting box. The program should prompt the user for these inputs, in
Using python programming and while loops. Create a program that will output a counting box.
The program should prompt the user for these inputs,
in
exactly this order:
1.
The width
of
the
box
2.
The
height
of the box
For these inputs, you can assume the following:
The height and
width will be integers greater than zero
Using this width and height, the program will print out a box where there are
width
numbers on each line and
height
rows. The numbers must count up
starting from 1, and should continue counting up (do
not
restart
the numbering).
HINT:
You can keep the
print()
function from printing on a new line by
using
end="
"
at the end:
print(
"Hello"
, end=
"
"
)
. If you do want
to print a new line, you can call print without an argument:
print()
.
You can put anything you want inside the quotation marks
a
bove
, we have
used a single space, to se
parate the numbers in the counting box. You can
also use an empty string, a comma, or
even whole words!
(See the next page fo
r sample output.)
Here is some sample output for
hw3
_part
6
.py
, with the user input in
blue
.
(Yours does not have to match this word for word, but it should be similar.)
bash
-
4.1$ python hw3_part
6
.py
Please enter a width: 4
Please enter a height: 2
1 23 4
5 6 7 8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started