Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3b50aa06
authored
Oct 01, 2017
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
1bd58b1a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
lab4/task1.py
lab4/task1.py
0 → 100644
View file @
3b50aa06
import
random
name
=
input
(
"Enter your name: "
)
age
=
input
(
"Enter your age: "
)
courses
=
[]
student
=
{
'name'
:
name
,
'age'
:
age
,
'courses'
:
courses
}
while
True
:
grades
=
[]
course
=
{
'course_name'
:
""
,
'grades'
:
grades
,
'average'
:
0
}
print
(
"Enter your courses' names, the grades will be generated automatically. Press 0 when you finish"
)
inp
=
input
()
if
inp
==
'0'
:
break
else
:
course
[
'course_name'
]
=
inp
for
x
in
range
(
0
,
10
):
grades
.
append
(
random
.
randrange
(
1
,
5
))
course
[
'average'
]
=
str
(
int
(
course
[
'average'
])
+
grades
[
grades
.
__len__
()
-
1
])
course
[
'grades'
]
=
grades
course
[
'average'
]
=
str
(
int
(
course
[
'average'
])
/
10
)
student
[
'courses'
]
.
append
(
course
)
for
x
in
range
(
0
,
student
[
'courses'
]
.
__len__
()):
print
(
"You got the average grade "
+
student
[
'courses'
][
x
][
'average'
]
+
" in "
+
student
[
'courses'
][
x
][
'course_name'
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment