Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102377293
randomly-pick-student
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Feb 20, 02:02
Size
964 B
Mime Type
text/x-python
Expires
Sat, Feb 22, 02:02 (2 d)
Engine
blob
Format
Raw Data
Handle
24341501
Attached To
R3683 Slides
randomly-pick-student
View Options
#!/usr/bin/python3
import
argparse
import
random
import
time
import
sys
import
os
import
signal
import
Slides.class_helper
as
ch
################################################################
def
signal_handler
(
sig
,
frame
):
os
.
system
(
'reset'
)
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
################################################################
config
=
ch
.
get_class_config
()
parser
=
argparse
.
ArgumentParser
(
description
=
'Mail to class helper'
)
students
=
config
[
'students'
]
# #### read the emails
students
=
[
student
for
i
,
student
in
students
.
iterrows
()]
chosen_student
=
random
.
choice
(
students
)
chosen_name
=
chosen_student
[
'Official name'
]
.
strip
()
chosen_email
=
chosen_student
[
'e-Mail'
]
.
strip
()
os
.
system
(
'reset'
)
print
(
'Winner is: '
,
end
=
''
)
sys
.
stdout
.
flush
()
for
i
in
range
(
10
):
time
.
sleep
(
.
1
)
print
(
'='
,
end
=
''
)
sys
.
stdout
.
flush
()
print
(
'> '
,
chosen_name
+
' ('
+
chosen_email
+
')'
)
time
.
sleep
(
60
)
Event Timeline
Log In to Comment