This Python program reads an integer from the user, representing the number of lines.
Using a loop, it prints the characters 'X' and '*' in each line.
This exercise helps practice basic loop structures and multi-character output formatting.
def print_x_and_star(lines):
for i in range(lines):
print("X *")
# Run the program
lines = int(input("Enter number of lines: "))
print_x_and_star(lines)
X *
X *
X *
- The program first reads the number of lines from the user
- A for loop runs for that many iterations
- In each iteration, it prints the string "X *" on a new line
- The result is a vertical list of lines, each containing the characters 'X' and '*'