Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!