Issue
I'm learning Python and one of my assignments was to create the following staircase, using user input for how many stairs:
How many stairs? 6
#####
#####
##########
##########
###############
###############
####################
####################
#########################
#########################
##############################
##############################
So far this is what I have:
stairs = int(input("How many stairs? "))
for i in range(1,stairs+1):
print("#####",end="")
for j in range(1,i):
print("#####",end="")
print()
This gives me
#####
##########
###############
####################
#########################
##############################
But how do I create a second line identical from the one above? I can't seem to figure it out...
Solution
You could just do like,
>>> stairs = 6
>>> for i in range(1, stairs+1):
... print("#####" * i)
... print("#####" * i)
...
#####
#####
##########
##########
###############
###############
####################
####################
#########################
#########################
##############################
##############################
Answered By - han solo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.