This is for a project at school, and I'm quite new to coding in python.
Basically, I am making a program that prints a set amount of 'X's and spaces, like X X X X X...
However, I want the user to choose how many 'X's and spaces they want to print.
This is all I've done so far:
xnum = input("Choose the amount of 'X's you would like to be printed")
xnum = xnum.upper()
spacenum = input("Choose the amount of spaces you would like to be printed")
linenum = input("Choose how many characters you would like to be displayed on one line")
I want to find out how to make the program print the number of 'X's the user asks for, and same with the spaces.
PS: I already have the code for how many characters per line, I just need some help on printing the set amount of 'X's and spaces.
This code assumes that by character you mean 'X' and not space.
xnum = int(input("Choose the amount of 'X's you would like to be printed\n"))
spacenum = int(input("Choose the amount of spaces you would like to be printed\n"))
linenum = int(input("Choose how many characters you would like to be displayed on one line\n"))
for i in range(xnum):
if(i%linenum==0 and i!=0):
print("")
print("X", end="")
if(spacenum!=0):
print(" ", end="")
spacenum -= 1