-
Notifications
You must be signed in to change notification settings - Fork 0
Lesson 2 #2
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
Open
MikeSalnikov
wants to merge
10
commits into
main
Choose a base branch
from
lesson_2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Lesson 2 #2
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f04f143
add lesson2
MikeSalnikov 8319a6d
add hw_2_1
MikeSalnikov 8d366b1
add
MikeSalnikov 1d6ce6c
add hw2_2
MikeSalnikov 46a41fa
add hw2_3
MikeSalnikov 847199f
add hw2_4
MikeSalnikov cbdf324
add hw2_5
MikeSalnikov e1e6ed1
addhw2_6
MikeSalnikov e528d62
Update hw2_3.py
MikeSalnikov 366d09c
added hw4
MikeSalnikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| word1 = 'Hello World' | ||
| word2 = 'one more everybody Hello World!' #ну а почему нет) вдруг не все успели прочитать) | ||
| print(f"{word1}, {word2}") #вывод в консоль оба слова | ||
| num1 = int(input('Введите число (день) - ')) | ||
| num2 = int(input('Введите число (месяц) - ')) | ||
| num3 = int(input('Введите число (год) - ')) | ||
| print(f"Если Вам повезло, то сегодня {num1}, {num2}, {num3} года") | ||
| word = input("Понравилось?: ") | ||
| print(f"{word} - отлично! будем рады вам снова!") #надеюсь выбрали ДА! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| time = int(input("Введите время в секундах - ")) | ||
| hour = time // 3600 | ||
| minut = (time // 60) - (hour * 60) | ||
| second = time % 60 | ||
| print(f"{hour:02}:{minut:02}:{second:02}") | ||
|
|
||
|
|
||
| # time = int(input("Введите время в секундах")) | ||
| # hours = time // 3600 | ||
| # minutes = time / 60 | ||
| # seconds = minutes / 60 | ||
| # print(f"{hours:02}:{minutes % 60:02}:{seconds % 60:02}") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| n = input("Введите число - ") | ||
|
|
||
| # использовать если числа будут меньше нуля | ||
| #while int(n) < 0: | ||
| # print('Число должно быть положительное (больше нуля)') | ||
| # n = input("Введите положительное число - ") | ||
|
|
||
| print(f"{n} + {n + n} + {n + n + n} = {int(n) + int(n + n) + int(n + n + n)}") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| num_integer = int(input('Введите целое положительное число - ')) | ||
| max_num = num_integer % 10 | ||
| num = num_integer | ||
|
|
||
| while num > 0: | ||
| digit = num % 10 | ||
| if digit > max_num: | ||
| max_num = digit | ||
| if digit == 9: | ||
| break | ||
| num = num // 10 | ||
| print(f"Наибольшая цифра в числе {num_integer} равна {max_num}") | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| proceeds = float(input("Введите занчение выручки - ")) | ||
| costs = float(input("Введите занчение издержек - ")) | ||
| result = proceeds - costs | ||
| if result > 0: | ||
| print(f"Ваша компания работает с прибылью {result} !") | ||
| print(f"Рентабельность выручки - {result / proceeds:.2f}") | ||
| employees = int(input("Сколько человек работает в вашей комапании? - ")) | ||
| print(f"Прибыль в расчете на одного сотрудника - {result / employees:.2f}") | ||
| elif result < 0: | ||
| print(f"Вы работаете с убытком, необходимо сократить издержки на - {-result} а потом пересмотреть стратегию компании") | ||
| else: | ||
| print(f"Ноль, нужно улучшить показатели!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| while True: | ||
| days = 1 | ||
| start = float(input('Введите дистанцию, которую пробеает спортсмен за первый день - ')) | ||
| last = float(input('Введите дистанцию, к которой готовиться спортсмен - ')) | ||
| if start <= 0 or last <= 0: | ||
| print('Результаты должны быть больше нуля! Стартовое значение != 0') | ||
| else: | ||
| while start < last: | ||
| start *= 1.10 | ||
| days += 1 | ||
| print(f'Спрортмену нужно на подготовку к забегу {days} день(дней)') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| spisok = list(input("Введите числа - ")) | ||
|
|
||
| for i in range(1, len(spisok), 2): | ||
| spisok[i - 1], spisok[i] = spisok[i], spisok[i - 1] #не уверен что именно это просят сделать, но вроде похоже | ||
| print(spisok) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| while True: | ||
| user_month = input('Введите номер месяца от 1 до 12: ') | ||
| if user_month.isdigit() and 0 <= int(user_month) <= 12: | ||
| # if 0 <= int(user_month) <= 12 and user_month.isdigit(): | ||
| season_1 = ['зима', 'весна', 'лето', 'осень', 'зима'] | ||
| season_2 = {0: 'зима', 1: 'весна', 2: 'лето', 3: 'осень', 4: 'зима'} | ||
| print(f'Список сезонов - {season_1[int(user_month) // 3]}\nСловарь сезонов - {season_2[int(user_month) // 3]}') | ||
| break | ||
| else: | ||
| print('Ошибка') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| string = input("Введите слова через пробел - ").split() | ||
| for i, words in enumerate(string, 1): | ||
| print(i, words) if len(words) <= 10 else print(i, words[:10]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| my_list = [6, 5, 4, 4, 3, 3, 2, 1] | ||
| number = int(input('Введите новое натуральное число - ')) | ||
| i = 0 | ||
| for n in my_list: | ||
| if number <= n: | ||
| i += 1 | ||
| my_list.insert(i, int(number)) | ||
| print(my_list) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| my_list = [] | ||
| title = {'название': '', 'цена': '', 'количество': '', 'единица измерения': ''} | ||
| feature = {'название': [], 'цена': [], 'количество': [], 'единица измерения': []} | ||
| num = 0 | ||
|
|
||
| while True: | ||
|
|
||
| for f in title.keys(): | ||
| product = input(f'Введите данные по товару {f} - ') | ||
| title[f] = int(product) if (f == 'цена' or f == 'количество') else product | ||
| feature[f].append(title[f]) | ||
| my_list.append((num, title.copy())) | ||
| print(f"\nИтого\n{my_list}") | ||
| for key, value in feature.items(): | ||
| print(f"{key[:25]:>30}: {value}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # 1. Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление. | ||
| # Числа запрашивать у пользователя, предусмотреть обработку ситуации деления на ноль. | ||
|
|
||
| def divide(num_1, num_2): | ||
| try: | ||
| num_1, num_2 = int(num_1), int(num_2) | ||
| divide_num = num_1 / num_2 | ||
| except ValueError: | ||
| return 'valueerror' | ||
| except ArithmeticError: | ||
| return 'Делить на ноль нельзя! Марти, возникнет Сингулярность, и весь пространственно-временной континиум будет уничтожен' | ||
| return round(divide_num, 2) | ||
|
|
||
| print(divide(input('Введите первое число - '), input('Введите второе число - '))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| list = [5, 6.5, None, False, 'Str', [5, 4], ('hello', 'word'), | ||
| (5, 6, 6.5), {7: 'seven', 8: 'eight'}, {9, 10}, | ||
| range(5)] | ||
|
|
||
| for i, item in enumerate(list, 1): | ||
| print(f"{i}) {item} - {type(item)}") |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Не должна предыдущая домашка попадать в пулл