PowerPoint Presentation Algorithms Programming with Python Module 1 – Python basics – Lesson 7 Nguyễn Chí Thức gthuwhile loop 2 while some.PowerPoint Presentation Algorithms Programming with Python Module 1 – Python basics – Lesson 7 Nguyễn Chí Thức gthuwhile loop 2 while some.
Algorithms & Programming with Python Module – Python basics – Lesson Nguyễn Chí Thức gthuc.nguyen@gmail.com 0986636879 while loop while some_condition: a block of statements while loop i = while i 0: n //= 10 length += print(length) while loop with else i = while i = 21: print('Total sum is', total_sum) break a = int(input()) else: print('Total sum is < 21 and is equal to', total_sum, '.') for loop with else for i in range(5): a = int(input()) if a < 0: print('Met a negative number', a) break else: print('No negative numbers met') continue in loops for num in range(2, 10): if num % == 0: print("Found an even number", num) continue print("Found a number", num) break & continue with nested loop for i in range(3): for j in range(5): if j > i: # breaks only the inner for break print(i, j) line while loop i = while (i i: # breaks only the inner for break print(i, j) line while loop i = while (i