forked from CWade3051/Py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpizzza.py
More file actions
34 lines (24 loc) · 668 Bytes
/
pizzza.py
File metadata and controls
34 lines (24 loc) · 668 Bytes
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
# Pizza Slicer
# Demonstrates string slicing
word = "pizza"
print(
"""
Slicing 'Cheat Sheet'
0 1 2 3 4 5
+---+---+---+---+---+
| p | i | z | z | a |
+---+---+---+---+---+
-5 -4 -3 -2 -1
"""
)
print("Enter the beginning and ending index for your slice of 'pizza'.")
print("Press the enter key at 'Begin' to exit.")
start = None
while start != "":
start = (input("\nStart: "))
if start:
start = int(start)
finish = int(input("Finish: "))
print("word[", start, ":", finish, "] is", end=" ")
print(word[start:finish])
input("\n\nPress the enter key to exit.")