-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHour4.py
More file actions
33 lines (30 loc) · 1.3 KB
/
Hour4.py
File metadata and controls
33 lines (30 loc) · 1.3 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
"""
Sams Teach Yourself Python in 24 Hours
by Katie Cunningham
Hour 4: Storing Text in Strings
Exercise:
1.
a) You're given a string that contains the body of an email.
If the email contains the word "emergency", print out
"Do you wnat to make this email urgent?"
If it contains the word "joke", print out
"Do you wnat to set this email as non-urgent?"
"""
#Hour 4: Storing Text in Strings
email_body = "This is an joke" #email type string
if 'Emeregency' in email_body:
importance = raw_input("Do you want to set this email as urgent? YES or NO: ")
if importance == "YES":
print ('Subject: Urgent! \n' + 'Message: ' + email_body.upper() + "!!!!!!!!!!!!") #urgent email
elif importance == "NO":
print ('Subject: Non-Urgent \n' + 'Message: ' + email_body.lower() + "!!!!!!!!!!!!") #non-urgent email
else:
print ('Subject: Regular \n' + 'Message: ' + email_body) #regular email
elif 'joke' in email_body:
importance = raw_input("Do you want to set this email as non-urgent? YES or NO: ")
if importance == "YES":
print ('Subject: Joke \n' + 'Message: ' + email_body.lower()) #non-urgent email
elif importance == "NO":
print ('Subject: Urgent \n' + 'Message: ' + email_body) #urgent email
else:
print ('Subject: Regular \n' + 'Message: ' + email_body) #regular email