The document contains a Python script demonstrating the use of a while loop to print 'hello world' followed by a number from 2 to 10. The loop increments the variable 'i' until it exceeds 10. Comments in the code indicate potential alternative implementations and outputs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
55 views1 page
While Loop - Py
The document contains a Python script demonstrating the use of a while loop to print 'hello world' followed by a number from 2 to 10. The loop increments the variable 'i' until it exceeds 10. Comments in the code indicate potential alternative implementations and outputs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
10/29/2018 while_loop.
py
1 # loops 2 # while loop, for loop 3 # print("hello world") # 10 times 4 5 i = 2 # i = 2 , i = 3 6 while i<=10: 7 print(f"hello world {i}") 8 i = i + 1 9 10 # hello world 11 # hello world 12 # hello world