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, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
If chris has a car liability insurance, what damage would he be covered for
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which feature of a blog to restore and retrieve older post
Answers: 3
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, 02.02.2021 23:20
question
Mathematics, 02.02.2021 23:20
question
Mathematics, 02.02.2021 23:20
question
Mathematics, 02.02.2021 23:20
question
Mathematics, 02.02.2021 23:20
question
Biology, 02.02.2021 23:20