-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguitarNotePractice.py
More file actions
51 lines (43 loc) · 1.36 KB
/
guitarNotePractice.py
File metadata and controls
51 lines (43 loc) · 1.36 KB
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
import sys, random as r
def printTitle():
print "\n|-------------------------------|"
print "|Welcome to Guitar Note Practice|"
print "|-------------------------------|\n"
def printOptions():
print "I'll give you:"
print " 1 A note in scientific pitch notation"
print " 2 A note and the string on which to play it"
print " 3 A new note of the day"
print " 4 Some advice"
print " 0 Quit\n"
def getNote():
return('ABCDEFG'[r.randint(0,6)])
def printNote(note):
print "The note of the day is {0}\n".format(note)
def printError():
print "\nInvalid entry, try again"
printOptions()
def getUserOptions(note):
printOptions()
while(True):
try:
userInput = int(input( "Enter your selection:\n"))
except:
printError()
if(userInput == 1):
print "\nPlay a {0}{1}\n".format(note, str(r.randint(1,4)))
elif(userInput == 2):
print "\nPlay a {0} on the {1} string".format(note, str(r.randint(1,6)))
elif(userInput == 3):
note = getNote()
print "\n Note of the day changed to {0}\n".format(note)
elif(userInput == 4):
print "Listen to Jerry Garcia"
elif userInput == 0:
sys.exit()
else:
printError()
note = getNote()
printTitle()
printNote(note)
getUserOptions(note)