Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write function called steps that should return a string #that, if printed, looks like this: # #111 # 222 # 333 # #Note that the

Write function called "steps" that should return a string

#that, if printed, looks like this:

#

#111

# 222

# 333

#

#Note that the characters at the beginning of the second and

#third lines must be tabs, not spaces. There should be one

#tab on the second line and two on the third line.

#

#You may only declare ONE string in your function.

#

#Hint: Don't overthink this! We're literally just asking you

#to return one single string that just holds the above text.

#You don't have to build the string dynamically or anything.

#Write function here!

def steps(number):

tabs =0

nums=1

newstring = ''

for i in range(1,number+1):

string = tabs*"\t"+str(nums)*3+' '

tabs+=1

nums+=1

newstring += string

return newstring

#The line below will test your function.

print(steps(3))

We found a few things wrong with your code. The first one is shown below, and the rest can be found in full_results.txt in the dropdown in the top left: We expected steps to return the str "111 222 333". However, it instead encountered the following error: TypeError: steps() missing 1 required positional argument: 'number' 

Can you please show me what is wrong with my code and why I'm getting this error. I've tried everything. Thanks

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Forms and levels of sponsorship

Answered: 1 week ago

Question

At the generating station power is..........?

Answered: 1 week ago

Question

The maximum number of electrons in a shell can be?

Answered: 1 week ago

Question

True or false The entire human population shows variations?

Answered: 1 week ago

Question

National park in India?

Answered: 1 week ago

Question

How did the guard ant recognise this ant ?

Answered: 1 week ago