Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moder dev
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
Hatice Yildirim
moder dev
Commits
1d604489
Commit
1d604489
authored
3 weeks ago
by
Hatice Yildirim
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into 'main'
RomanConverter See merge request
!1
parents
fbb4ce84
4c9db96e
Branches
main
No related tags found
1 merge request
!1
RomanConverter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
converter.py
+49
-0
49 additions, 0 deletions
converter.py
hello.py
+0
-1
0 additions, 1 deletion
hello.py
with
49 additions
and
1 deletion
converter.py
0 → 100644
+
49
−
0
View file @
1d604489
#Bei Eingabe von Zahlen, die in der Liste definiert sind, sollen römische Zhalen zurückgegeben werden.
#Bei Eingabe von Zahlen, die nicht in der Liste definiert ist, soll ein "" ausgeben werden.
import
unittest
from
abc
import
ABC
,
abstractmethod
class
IRomanNumber
(
ABC
):
@abstractmethod
def
convert
(
self
,
n
:
int
)
->
str
:
pass
class
RomanNumber
(
IRomanNumber
):
def
convert
(
self
,
n
:
int
)
->
str
:
roman_numerals
=
{
1
:
"
I
"
,
2
:
"
II
"
,
3
:
"
III
"
,
4
:
"
IV
"
,
5
:
"
V
"
,
9
:
"
IX
"
,
21
:
"
XXI
"
,
50
:
"
L
"
,
100
:
"
C
"
,
500
:
"
D
"
,
1000
:
"
M
"
}
return
roman_numerals
.
get
(
n
,
""
)
class
TestRomanConverter
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
converter
=
RomanNumber
()
def
test_single_value
(
self
):
self
.
assertEqual
(
self
.
converter
.
convert
(
1
),
"
I
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
2
),
"
II
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
3
),
"
III
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
4
),
"
IV
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
5
),
"
V
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
9
),
"
IX
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
21
),
"
XXI
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
50
),
"
L
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
100
),
"
C
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
500
),
"
D
"
)
self
.
assertEqual
(
self
.
converter
.
convert
(
1000
),
"
M
"
)
def
test_inivalid_numbers
(
self
):
self
.
assertEqual
(
self
.
converter
.
convert
(
6
),
""
)
self
.
assertEqual
(
self
.
converter
.
convert
(
99
),
""
)
self
.
assertEqual
(
self
.
converter
.
convert
(
-
1
),
""
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
hello.py
deleted
100644 → 0
+
0
−
1
View file @
fbb4ce84
print
(
"
Hello world
"
)
\ 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