November 29th, 2012, 09:58 AM
Printing multiple lines in a user input range?
I need help with programming something in python
I need to take the users input on how many lines to print of x, then print that line and all lines prior
For example if the user in puts 7 lines, I need the program to evaluate
I have tried using the current code with a for loop and a range, but am still having problems, can anyone point me in the right direction?
n = input("How many lines would you like to print?"
for n in range (0,100)
print: "x" * n
I was thinking this would work, but I keep on getting an error in regards to the print portion. Anyone know where I am going wrong?
November 29th, 2012, 10:52 AM
The print statement (or function in v3.x) doesn't take ":"s.
Originally Posted by brod615
>>> n=int(raw_input('number of lines '))
number of lines 8
>>> for i in xrange(n): print i*'x'