cshw/py/Loops./task1.py

8 lines
No EOL
346 B
Python

# Infinite loop that prints "Hi" until the user enters "STOP"
while True: # This creates an infinite loop
user_input = input("Hi\n") # Prints "Hi" and waits for user input
# Check if the user input (ignoring spaces and case) is "STOP"
if user_input.strip().upper() == "STOP":
break # Exit the loop if the condition is met