Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1dd2c829
Kaydet (Commit)
1dd2c829
authored
Agu 25, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Cosmetic fixes to make this work with Py3k (as well as with 2.5 still).
Patch by Christian Heimes.
üst
6398b7a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
roman.py
Doc/tools/roman.py
+5
-5
No files found.
Doc/tools/roman.py
Dosyayı görüntüle @
1dd2c829
...
...
@@ -40,9 +40,9 @@ romanNumeralMap = (('M', 1000),
def
toRoman
(
n
):
"""convert integer to Roman numeral"""
if
not
(
0
<
n
<
5000
):
raise
OutOfRangeError
,
"number out of range (must be 1..4999)"
if
int
(
n
)
<>
n
:
raise
NotIntegerError
,
"decimals can not be converted"
raise
OutOfRangeError
(
"number out of range (must be 1..4999)"
)
if
int
(
n
)
!=
n
:
raise
NotIntegerError
(
"decimals can not be converted"
)
result
=
""
for
numeral
,
integer
in
romanNumeralMap
:
...
...
@@ -67,9 +67,9 @@ romanNumeralPattern = re.compile("""
def
fromRoman
(
s
):
"""convert Roman numeral to integer"""
if
not
s
:
raise
InvalidRomanNumeralError
,
'Input can not be blank'
raise
InvalidRomanNumeralError
(
'Input can not be blank'
)
if
not
romanNumeralPattern
.
search
(
s
):
raise
InvalidRomanNumeralError
,
'Invalid Roman numeral:
%
s'
%
s
raise
InvalidRomanNumeralError
(
'Invalid Roman numeral:
%
s'
%
s
)
result
=
0
index
=
0
...
...
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