-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
up #2
base: master
Are you sure you want to change the base?
up #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Оставил комментарии по коду
# то программа должна сообщать ему об ошибке и снова запрашивать знак операции. | ||
# Также сообщать пользователю о невозможности деления на ноль, если он ввел 0 в качестве делителя. | ||
|
||
sign = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отлично
# 2. Посчитать четные и нечетные цифры введенного натурального числа. | ||
# Например, если введено число 34560, то у него 3 четные цифры (4, 6 и 0) и 2 нечетные (3 и 5). | ||
|
||
num = int(input('Введите натуральное число: ')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отлично
# 3. Сформировать из введенного числа обратное по порядку входящих в него цифр и вывести на экран. | ||
# Например, если введено число 3486, то надо вывести число 6843. | ||
|
||
num = int(input('Введите целое положительное число: ')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отличная работа
if num_input == num_rand: | ||
print('Вы угадали') | ||
break | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно заменить на elif
для краткости и читаемости.
# 8. Посчитать, сколько раз встречается определенная цифра в введенной последовательности чисел. | ||
# Количество вводимых чисел и цифра, которую необходимо посчитать, задаются вводом с клавиатуры. | ||
|
||
def count_digit(num, digit): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отлично
# Вывести на экран это число и сумму его цифр. | ||
|
||
|
||
def get_num_sum(num): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И тут отлично
No description provided.