Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ternytskano/first/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Вивести кількість цілих чисел у списку

"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зайві відступи у коді


my_list = ['qwert', 'abc', 3, 4.09, 7, 10, 'rtt']
counter = 0
for el in my_list:
if isinstance(int) == int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Невірна умова, потрібно написати: if isinstance(el, int):

counter +=1
print(counter)

4 changes: 4 additions & 0 deletions ternytskano/first/task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
Вивести слова в нижньому регістрі

"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`
start_str = "Abcde aksd askd ASodk wasD LMZGL 123123"
temp_list = start_str.split()
[print(element) for element in temp_list if element.islower()]

`

4 changes: 4 additions & 0 deletions ternytskano/first/task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
Знайти середне значення чисел у заданому користувачем діапазоні

"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`first_num, second_num = int(input("Введіть початковый елемент:")), int(input("Введіть кінцевий елемент:"))
sum, counter = 0, 0
for i in range(first_num, second_num+1):
sum += i
counter += 1
print(sum/counter)

`

14 changes: 14 additions & 0 deletions ternytskano/second/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Користувач вводить число до 4000. Вивести число римськими цифрами.

"""


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зайві відступи у коді


import re
def if_numb(text):
text = re.match(r'^[^4][\d]{1,3}',text)
def val_numb():
while not if_numb():
print("input number")
number = val_numb()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`
import re
def is_num(text):
return bool(re.match(r'^[1-30]?\d{1,3}$',text))
def num_validator(user_str=""):
temp_str = input(user_str)
while not is_num(temp_str):
temp_str = input(user_str)
return int(temp_str)
def to_Roman(num):
result = ''
for arabic, roman in zip((1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1),'M CM D CD C XC L XL X IX V IV I'.split()):
result += num // arabic * roman
num %= arabic
return result
user_num = num_validator("Введіть число до 4000: ")
print(to_Roman(user_num))

`