Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is a sample Python script.
- # Press Shift+F10 to execute it or replace it with your code.
- # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
- def print_hi(name):
- # Use a breakpoint in the code line below to debug your script.
- print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
- # Press the green button in the gutter to run the script.
- if __name__ == '__main__':
- print_hi('PyCharm')
- # See PyCharm help at https://www.jetbrains.com/help/pycharm/
- def fizzBuzz():
- for i in range(1, 101):
- if (i % 5 == 0):
- print("Buzz")
- elif (i % 3 == 0):
- print("Fizz")
- else:
- print(i)
- def wyswietlCyfreSlownie():
- liczba = str(input("Podaj dowolna liczbe: "))
- nazwyCyfr = ["zero", "jeden", "dwa", "trzy", "cztery", "piec", "szesc", "siedem", "osiem", "dziewiec"]
- for i in range(len(liczba)):
- print(nazwyCyfr[int(liczba[i])])
- def zamianaNaRzymskie():
- rzymskie = {"1" : "I", "2" : "II", "3" : "III", "4" : "IV", "5" : "V",
- "6" : "VI", "7" : "VII", "8" : "VIII", "9" : "IX", "10" : "X",
- "50" : "L", "100" : "C", "500" : "D", "1000" : "M"}
- liczbaRzymska = ''
- liczbaArabska = str(input("Podaj liczbe w systemie arabskim: "))
- liczbaArabskaDlugosc = len(liczbaArabska)
- liczbaArabskaInt = int(liczbaArabska)
- while liczbaArabskaInt > 0:
- if liczbaArabskaInt > 1000:
- for i in range (liczbaArabskaInt // 1000):
- liczbaRzymska += rzymskie["1000"]
- liczbaArabskaInt -= liczbaArabskaInt // 1000 * 1000
- if liczbaArabskaInt > 500:
- for i in range (liczbaArabskaInt // 500):
- liczbaRzymska += rzymskie["500"]
- liczbaArabskaInt -= liczbaArabskaInt // 500 * 500
- if liczbaArabskaInt > 100:
- for i in range(liczbaArabskaInt // 100):
- liczbaRzymska += rzymskie["100"]
- liczbaArabskaInt -= (liczbaArabskaInt // 1000) * 100
- if liczbaArabskaInt > 50:
- for i in range(liczbaArabskaInt // 50):
- liczbaRzymska += rzymskie["50"]
- liczbaArabskaInt -= (liczbaArabskaInt // 50) * 50
- if liczbaArabskaInt > 10:
- for i in range(liczbaArabskaInt // 10):
- liczbaRzymska += rzymskie["10"]
- liczbaArabskaInt -= (liczbaArabskaInt // 10) * 10
- liczbaRzymska += rzymskie[str(liczbaArabskaInt)]
- print(liczbaRzymska)
- #fizzBuzz()
- #wyswietlCyfreSlownie()
- zamianaNaRzymskie()
Add Comment
Please, Sign In to add comment