Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PP-arvonta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Maintenance moved to Monday 17.3. at 13:00. ETA 60 - 90 minutes.
Show more breadcrumbs
Mikko Meriö
PP-arvonta
Commits
dbe40a7e
Commit
dbe40a7e
authored
2 years ago
by
Mikko Meriö
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
3de7a731
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rigged.py
+56
-0
56 additions, 0 deletions
rigged.py
with
56 additions
and
0 deletions
rigged.py
0 → 100644
+
56
−
0
View file @
dbe40a7e
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 4 21:21:43 2023
@author: mikkomerio
"""
import
random
from
datetime
import
datetime
import
time
def
suorita_arvonta
():
"""
Ohjelma suorittaa rigged arvonnan
"""
print
(
kello
.
strftime
(
"
\n
Aloitetaan arvonta ajassa %H:%M
"
))
# Sekoitetaan järjestys
random
.
shuffle
(
lista
)
# Arvotaan pseudosatunnaisluku listan indekseistä
arpaluku
=
random
.
randint
(
0
,
potti
-
1
)
print
(
f
"
\n
Onnetar valitsi luvun
{
arpaluku
}
\n
"
)
time
.
sleep
(
4
)
print
(
"
Tämänpäiväisen PP-arvonnan on siis voittanut:
\n
"
)
time
.
sleep
(
3
)
print
(
f
"
{
lista
[
arpaluku
]
}
\n
"
)
print
(
"
Onnea voittajalle!!
"
)
#-------------------------------------------------------------------
kello
=
datetime
.
now
()
print
(
kello
.
strftime
(
"
Tervetuloa PP-arvontaan %d.%m.%Y
\n
"
))
with
open
(
"
osallistujat.txt
"
)
as
tied
:
lista
=
[
osallistuja
.
strip
()
for
osallistuja
in
tied
]
potti
=
len
(
lista
)
print
(
"
Osallistujat ovat:
"
)
for
osallistuja
in
lista
:
print
(
osallistuja
)
print
(
f
"
\n
Ja potissa on
{
potti
}
€
"
)
vastaus
=
input
(
"
Haluatko suorittaa arvonnan? (k/e)
"
)
if
vastaus
==
"
k
"
:
suorita_arvonta
()
else
:
print
(
"
Voi harmi. Tällä viikolla ei arvottu perjantaipulloa :(
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment