Skip to content

Conversation

@Nicole-ternytska
Copy link

No description provided.

Вивести кількість цілих чисел у списку

"""

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):

"""
Вивести слова в нижньому регістрі

""" No newline at end of file

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()]

`

"""
Знайти середне значення чисел у заданому користувачем діапазоні

""" No newline at end of file

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)

`


"""


Choose a reason for hiding this comment

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

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

def val_numb():
while not if_numb():
print("input number")
number = val_numb() No newline at end of file

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))

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants