This Python program reads an integer from the user, representing the number of asterisks to display.
Using a for loop, it prints that many '*' characters in the terminal.
This exercise is ideal for practicing basic loop structures and character-based output formatting.
def print_stars(n):
for i in range(n):
print("*", end=" ")
print()
# Run the program
count = int(input("Enter number of stars: "))
print_stars(count)
* * * * * *
- The program first reads an integer from the user, representing the number of stars
- A for loop runs for that many iterations
- In each iteration, it prints a '*' character followed by a space
- The result is a single line of asterisks spaced evenly across the terminal