-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path2. ShiftWorker - HARD
More file actions
142 lines (117 loc) · 4.57 KB
/
Copy path2. ShiftWorker - HARD
File metadata and controls
142 lines (117 loc) · 4.57 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
'''
Basic script for office type jobs
Created By: Ty'Shawn G. Gaines
DATE: 9/22/2017
'''
import time, random, datetime, smtplib
#-- prints out todays date --#
thedate = datetime.date.today()
#-- adds employee into list if they are not in the list --#
emplist=[]
#-- fuction for shiftwork --#
def shiftwork():
employee=input('What is your name?\n')
while (employee.isdigit()) or (employee==''):
print('Please try again.\n')
employee=input('What is your name?\n')
if employee in emplist:
pass
else:
emplist.append(employee)
coolphrase=['Hi this is','Whats up it\'s','Hello it\'s me again','Hey stranger! it\'s me again','Long time no see, it\'s']
emplname=(random.choice(coolphrase))+' %s'%(employee.title())+'. \n'
worklog=open('worklog.txt','w')
worklog.write('Todays date: '+str(thedate)+'\n')
worklog.write(emplname)
worklog.close()
print(('Greetings %s,')%(employee.title())+'\n')
time.sleep(0.5)
print('What shift did you work?')
day=input('Morning (m), Afternoon (a),Evening (e) \n')
if (day== 'm') or (day =='M'):
day=['I worked the morning shift today\n','Well I worked the morning shift.\n','I did the morning shift today.\n','I was on the morning shift.\n']
worklog=open('worklog.txt','a')
worklog.write(random.choice(day))
worklog.close()
print ('Morning')
print ('Morning')
elif (day== 'a') or (day =='A'):
day=['Once again I worked the afternoon shift\n','Well I worked the afternoon shift.\n','I did the afternoon shift today.\n','I was on the afternoon shift.\n']
worklog=open('worklog.txt','a')
worklog.write(random.choice(day))
worklog.close()
print ('Afternoon')
elif (day== 'e') or (day =='E'):
day=['Hey buddy I worked the evening.\n','Well I worked the evening shift.\n','I did the evening shift today.\n','I was on the evening shift.\n']
worklog=open('worklog.txt','a')
worklog.write(random.choice(day))
worklog.close()
print ('Evening')
else:
time.sleep(0.5)
print(day)
call=0
while call<3:
calllist=['Today I took ','Well on my shift I took ','Well until now I took ','It was a easy ','Honestly I only took a total of ']
calls=input('how many calls did you take?\n')
if (calls.isdigit()):
print('you took '+calls+' calls today.')
worklog=open('worklog.txt','a')
worklog.write(random.choice(calllist)+calls+' calls today.\n')
worklog.close()
break
else:
time.sleep(0.5)
print('Not a number.')
time.sleep(0.5)
print(calls)
call+=1
chars=0
while chars<300:
final=input('Any comments? Yes(y),No(n)\n')
if (final=='y') or (final=='Y'):
final=input('Type additional comments: \n')
worklog=open('worklog.txt','a')
if chars%16==0:
worklog.write(final+'\n')
else:
worklog.write(final)
worklog.close()
elif (final=='n') or (final=='N'):
worklog.close()
print('Done see you tomorrow.')
break
else:
break
chars+=len(final)
print(chars)
print('\nFile was auto-saved as worklog.txt on your drive for refrence')
print('Take care folks!')
print('Current date is: '+str(thedate))
#-- Initial question to begain workflow --
q=0
while q<1:
print('Work log title: shiftwork()\nType: shiftwork() to resubmit to co-workers\n')
print('Are you ready to submit log to co-workers for today?')
question=input('Type: yes(y),no(n)\n')
if (question=='y') or (question=='Y'):
shiftwork()
elif (question=='n') or (question=='N') or (question==''):
break
else:
print('please try again..\n')
q+=1
#-- gathers information to log into gmail account --#
email=input('\nEnter your Gmail email to login\n')
password=input('\nEnter your Gmail passowrd to complete login\n')
From=input('\nEnter your own email as sender\n')
to=input('\nEnter email address of recipent\n')
subject=input('Subject:\n')
emailbody=input('Type Your email body here (example: here is the report from our work day. Check it out!)\n')
subject_emailbody='Subject:{}\n\n{}'.format(subject,emailbody)
#-- log into email with infomation provided --#
netconnect = smtplib.SMTP('smtp.gmail.com',587)
netconnect.starttls()
netconnect.login(email,password)
print(netconnect.sendmail(From,to,subject_emailbody))
netconnect.quit()