Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TTC2030
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
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
Show more breadcrumbs
AB6912
TTC2030
Commits
c1ed3a2b
Commit
c1ed3a2b
authored
3 years ago
by
unknown
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
ddf9df7d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Demot/testi.py
+38
-0
38 additions, 0 deletions
Demot/testi.py
L12 Luokat ja oliot/L12T03.py
+1
-1
1 addition, 1 deletion
L12 Luokat ja oliot/L12T03.py
with
39 additions
and
1 deletion
Demot/testi.py
0 → 100644
+
38
−
0
View file @
c1ed3a2b
import
random
class
question
:
def
__init__
(
self
,
q
,
a
):
self
.
q
=
q
self
.
a
=
a
def
__str__
(
self
):
return
f
"
{
self
.
q
}
,
{
self
.
a
}
"
q1
=
question
(
"
Testquestion?
"
,
"
Testanswer
"
)
q2
=
question
(
"
Testquestion2?
"
,
"
Testanswer2
"
)
q3
=
question
(
"
Testquestion?3
"
,
"
Testanswer3
"
)
questions
=
[
q1
,
q2
,
q3
]
questionCount
=
0
correctCount
=
0
while
True
:
if
questionCount
<
11
:
guestion
=
random
.
choice
(
questions
)
print
(
guestion
.
q
)
answer
=
input
(
"
Enter your answer here:
"
)
if
answer
==
guestion
.
a
:
print
(
"
Correct!
"
)
correctCount
+=
1
else
:
print
(
"
Wrong!
"
)
questionCount
+=
1
else
:
if
correctCount
==
10
:
print
(
f
"
You scored
{
correctCount
}
/10! Great job!
"
)
elif
correctCount
>
8
:
print
(
f
"
You scored
{
correctCount
}
/10! Not bad!
"
)
elif
correctCount
>
5
:
print
(
f
"
You scored
{
correctCount
}
/10! You can definitely do better!
"
)
elif
correctCount
>
0
:
print
(
f
"
You scored
{
correctCount
}
/10! That wasn
'
t good, better luck next time!
"
)
else
:
print
(
f
"
You scored
{
correctCount
}
/10! You should at least try next time...
"
)
break
\ No newline at end of file
This diff is collapsed.
Click to expand it.
L12 Luokat ja oliot/L12T03.py
+
1
−
1
View file @
c1ed3a2b
...
...
@@ -4,7 +4,7 @@ class Car:
self
.
model
=
model
self
.
price
=
price
def
__str__
(
self
):
return
f
"
{
self
.
brand
}
{
self
.
model
}
{
str
(
self
.
price
)
}
"
return
f
"
{
self
.
brand
}
{
self
.
model
}
{
self
.
price
}
"
car1
=
Car
(
"
Skoda
"
,
"
Octavia
"
,
3000
)
car2
=
Car
(
"
Audi
"
,
"
A4
"
,
4000
)
...
...
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