Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72694731
randomly_pick_student.py
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
Tue, Jul 16, 14:54
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jul 18, 14:54 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19090816
Attached To
R3683 Slides
randomly_pick_student.py
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
)
def
main
():
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
)
################################################################
if
__name__
==
"__main__"
:
main
()
Event Timeline
Log In to Comment