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
6 changes: 3 additions & 3 deletions 1_if1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def main():
Эта функция вызывается автоматически при запуске скрипта в консоли
В ней надо заменить pass на ваш код
"""
age = int(input('Сколько Вам лет? '))
print('Ваш возраст:', age, 'лет!')
activity = age_detector(age)
age_to_ptint = int(input('Сколько Вам лет? '))
print('Ваш возраст:', age_to_print, 'лет!')
activity = age_detector(age_to_print)
#return age
print(activity)

Expand Down
26 changes: 24 additions & 2 deletions 2_if2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,35 @@

"""
#Здесь я буду писать свою функцию!
def comparison_function(string_1, string_2):
if isinstance(string_1, str) and isinstance(string_2, str):
# return 0
#else:

Choose a reason for hiding this comment

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

не нужный код лучше сразу удалять

if string_1 == string_2:
return 1
elif (not (string_1 == string_2) and len(string_1) > len(string_2)):

Choose a reason for hiding this comment

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

первая часть условия не нужна, так как у тебя не независимое условие, а elif

return 2
elif string_2 == 'learn':
return 3
else:
return 0


def main():
"""
Эта функция вызывается автоматически при запуске скрипта в консоли
В ней надо заменить pass на ваш код
"""
pass

# a = comparison_function('stiiing1', 'stringgggg2')
# print(a)
print(comparison_function(1, 'stringgg2'))
#print(a)
print(comparison_function('stringgg2', 'stringgg2'))
#print(a)
print(comparison_function('stringgg2', 'learn'))
#print(a)
print(comparison_function(10, 5))
#print(a)

if __name__ == "__main__":
main()