Python - program to print steps -


I am creating a program, which is as follows <.

  How many steps? 4__ _ | _ | _ ________ | How many steps? 1___ Using  

_ and |

So far I have found this as my code (too much waste)

  i = int (input ('how many steps?')) Spc = (' ') S =' '* inp z =' \ n '' '' '_' print ('__' + z * i + '__' * i)  

Will you be able to give some help on this?

Thanks

You can use for loop Can I print the head (N-1): print ("" * (* *) (for the "__") # range print ("__"):

  n = int (input ('how many steps?')) I 1) + "|" + "_") Print ("__" * n + "|") # Last step  

Note: This works Is n> 0 .


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -