-
Notifications
You must be signed in to change notification settings - Fork 0
Hw 1 #1
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
Merged
Hw 1 #1
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f37a8f3
copied the condition of the task 02
PolitovAS 25d5929
copied the condition of the task 02
PolitovAS e33459d
solved the task_02
PolitovAS 15595af
solved the task_04
PolitovAS ebbe6dd
solved the task_06
PolitovAS e0455f0
solved the task_08
PolitovAS 529fd9f
Update HW_1/task_02.py
PolitovAS 5b3952f
Update HW_1/task_08.py
PolitovAS 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,13 @@ | ||
| # Найдите сумму цифр трехзначного числа. | ||
|
|
||
| # *Пример:* | ||
|
|
||
| # 123 -> 6 (1 + 2 + 3) | ||
| # 100 -> 1 (1 + 0 + 0) | ||
|
|
||
| nums = int(input('Введите трехзначное число: ')) | ||
| sum = 0 | ||
| for _ in str(nums): | ||
| sum += nums % 10 | ||
| nums //= 10 | ||
| print(sum) |
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 @@ | ||
| # Петя, Катя и Сережа делают из бумаги журавликов. Вместе они сделали S журавликов. | ||
| # Сколько журавликов сделал каждый ребенок, если известно, что Петя и Сережа сделали одинаковое количество журавликов, | ||
| # а Катя сделала в два раза больше журавликов, чем Петя и Сережа вместе? | ||
|
|
||
| # *Пример:* | ||
|
|
||
| # 6 -> 1 4 1 | ||
| # 24 -> 4 16 4 | ||
| # 60 -> 10 40 10 | ||
|
|
||
| nums = int(input('Введите количество журавликов: ')) | ||
| print(nums // 3 // 2, nums // 3 * 2, nums // 3 // 2) | ||
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 @@ | ||
| # Вы пользуетесь общественным транспортом? | ||
| # Вероятно, вы расплачивались за проезд и получали билет с номером. | ||
| # Счастливым билетом называют такой билет с шестизначным номером, где сумма первых трех цифр равна сумме последних трех. | ||
| # Т.е. билет с номером 385916 – счастливый, т.к. 3+8+5=9+1+6. Вам требуется написать программу, которая проверяет счастливость билета. | ||
|
|
||
| # *Пример:* | ||
|
|
||
| # 385916 -> yes | ||
| # 123456 -> no | ||
|
|
||
| nums = input('Введите номер билетика: ') | ||
| print('yes' if int(nums[0]) + int(nums[1]) + int(nums[2]) == int(nums[3]) + int(nums[4]) + int(nums[5]) else 'no') | ||
PolitovAS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 @@ | ||
| # Требуется определить, можно ли от шоколадки размером n × m долек отломить k долек, | ||
| # если разрешается сделать один разлом по прямой между дольками (то есть разломить шоколадку на два прямоугольника). | ||
|
|
||
| # *Пример:* | ||
|
|
||
| # 3 2 4 -> yes | ||
| # 3 2 1 -> no | ||
|
|
||
| n = int(input("Введите длинну шоколадки: ")) | ||
| m = int(input("Введите ширину шоколадки: ")) | ||
| k = int(input("Сколько долек вы хотите отломить?: ")) | ||
|
|
||
| print('yes' if n * m > k and (k % n == 0 or k % m == 0) else 'no') |
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.
Uh oh!
There was an error while loading. Please reload this page.