π Python Crash Course – Chapter 7: User Input And while loops – Exercise 7-7 Solution
Welcome to another solution from Python Crash Course by Eric Matthes.
π Exercise 7-7
Task:
Write a loop that never ends, and run it . (To end the loop, press
ctrl-C or close the window displaying the output) .
✅ Solution Code:
while 1 > 0: # This condition is always true, so the loop will never end
print("This loop will never end.")
# You can stop the loop by pressing Ctrl+C or closing the window
π§ Code Explanation:
1 > 0 condition is always true, so the loop will never endπ Output:
This loop will never end.
This loop will never end.
This loop will never end.
This loop will never end.
This loop will never end.
This loop will never end.
This loop will never end.
This loop will never end.
# It will Run Infinitely
π Related Exercises from Chapter 7:
- ➤ Exercise 7-1 | Rental Car
- ➤ Exercise 7-2 | Restaurant Seating
- ➤ Exercise 7-3 | Multiples of Ten
- ➤ Exercise 7-4 | Pizza Toppings
- ➤ Exercise 7-5 | Movie Tickets
- ➤ Exercise 7-6 | Three Exits
- ➤ Exercise 7-7 | Infinity
- ➤ Exercise 7-8 | Deli
- ➤ Exercise 7-9 | No Pastrami
- ➤ Exercise 7-10 | Dream Vacation
π Connect With Us:
“In the world of code, Python is the language of simplicity, where logic meets creativity, and every line brings us closer to our goals.”
— Only Python
π Tags: #Python #PythonCrashCourse #CodingForBeginners #LearnPython #PythonProjects #PythonTips
πTrending Topics
π Connect With Us:
“In the world of code, Python is the language of simplicity, where logic meets creativity, and every line brings us closer to our goals.”— Only Python
π Follow Us And Stay Updated For Daily Updates
Comments
Post a Comment