subject

Can someone help me out with this one? I'm not sure why my code is not working Now, let's improve our steps() function to take one parameter
that represents the number of 'steps' to print. It should
then return a string that, when printed, shows output like
the following:
print(steps(3))
111
222
333
print(steps(6))
111
222
333
444
555
666
Specifically, it should start with 1, and show three of each
number from 1 to the inputted value, each on a separate
line. The first line should have no tabs in front, but each
subsequent line should have one more tab than the line
before it. You may assume that we will not call steps() with
a value greater than 9.
Hint: You'll want to use a loop, and you'll want to create
the string you're building before the loop starts, then add
to it with every iteration.
Write your function here
def steps(number):
i = 1
while i < number + 1:
string = str(i) * 3
string1 = str(string)
if i != 0:
string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string
elif i == 1:
string1 = string
print(string1)
i = i + 1
#The following two lines will test your code, but are not
#required for grading, so feel free to modify them.
print(steps(3))
print(steps(6)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
What is estimated time of arrival (eta)? a device that measures the acceleration (the rate of change of velocity) of an item and is used to track truck speeds or taxi cab speeds a gps technology adventure game that posts the longitude and latitude location for an item on the internet for users to find a north/south measurement of position the time of day of an expected arrival at a certain destination and is typically used for navigation applications
Answers: 3
question
Computers and Technology, 24.06.2019 13:20
In the insert table dialog box, you select the checkbox to create the first row as the header of the table.
Answers: 3
question
Computers and Technology, 25.06.2019 04:00
Has anyone noticed that has been giving the wrong answers and that the ads are blocking answers or is that just me?
Answers: 2
You know the right answer?
Can someone help me out with this one? I'm not sure why my code is not working Now, let's improve o...
Questions
question
Mathematics, 10.12.2020 01:00
question
Mathematics, 10.12.2020 01:00
question
Geography, 10.12.2020 01:00
question
Mathematics, 10.12.2020 01:00
question
Biology, 10.12.2020 01:00
question
Mathematics, 10.12.2020 01:00
Questions on the website: 13722363