-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhile_loop_notes_ starter.py
54 lines (30 loc) · 1.13 KB
/
while_loop_notes_ starter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# while loop notes
'''
while loop, written in English (PSEUDOCODE):
while statement tests the LOOP CONDITION
while condition is True, run this block of code (LOOP BODY)
if condition becomes false (SENTINEL VALUE is met), this block is skipped and loop ends
loop ends and program continues sequentially
# WHILE LOOP -
# LOOP CONDITION -
# LOOP BODY -
# LOOPING VARIABLE -
# SENTINEL VALUE -
'''
# How to use a counter
# Keeps track of number of times loop is executed.
# Common mistake:
input("\nPress enter to continue.\n")
# Countdown Challenge (on own)
# Make a counter that counts down from 10 and then says "BLAST OFF!"
input("\nPress enter to continue.\n")
# Count by 5's Challenge(on own)
# Count 0-100 by 5's
# Print a message to tell the user when the count is half-way done
input("\nPress enter to continue.\n")
# die_roller Challenge (partner)
# Guess how many rolls it takes to roll a 5?
input("\nPress enter to continue.\n")
# die_roller2 Challenge (partner)
# Display how many evens after 5 rolls of a die.
input("\nPress enter to exit.\n")