-
Notifications
You must be signed in to change notification settings - Fork 0
modul_4 #123
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
base: main
Are you sure you want to change the base?
modul_4 #123
Changes from all commits
5f981e8
50fbb06
4480e47
f0e5b4f
6546301
0396ac4
d1ae1d2
f8ebcf6
1de2767
0140866
d57c550
6f0e784
99caee8
7d33bc6
dc7165d
583750e
33c8022
1c9dd65
3d136fd
2106725
3a087af
bb9e858
05ea523
cd4a11f
13450fc
dc9ca19
e52db46
34043d1
05802e2
8d63735
c82da1c
068f732
3d2ca06
76e399e
e544a07
ec59753
23b9001
197f4b8
04da033
2de763f
b2d63b1
572ec64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name = input("Введите имя рыцаря: ") | ||
| name_zdorov = input("Кол-во здоровья: ") | ||
| name_yron = input("урон от его меча: ") | ||
| name_zapas = input("Кол-во зелий здоровья: ") | ||
| print("Герой по имени", name, "отправляется в сказочное приключение. На его пути встречается мерзкий, злой Гоблин") | ||
| name_goblin = input("Имя Гоблина:") | ||
| gobli_zdorov = input("Здоровье Гоблина: ") | ||
| goblin_yron = input("Урон здоровья рыцарю: ") | ||
| goblin_zapas = input("запас здоровья Гоблина: ") | ||
| print("Отважный рыцарь встречает Гоблина на своём пути. У него", name_goblin, "Здоровья", gobli_zdorov, "а урон от его меча", goblin_yron,) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| a = input("введите первое число: ") | ||
| b = input("введите второе число: ") | ||
| print("Result",int(a) + int(b)) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| a = input("введите первое число: ") | ||
| b = input("введите второе число: ") | ||
| decod = print("Result",int(a) - int(b)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| word = "арзамас" | ||
| print(len(word)) # узнал сколько в слове символов | ||
|
|
||
| for el in range(len(word)): # перебрал слово в цикле | ||
| print(el,[0,7]) | ||
|
|
||
|
|
||
| if word[el] == "а": #проверили каждую букву на соответствие букве а | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Для чего нужна эта проверка с использованием el вне цикла?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не могу ответить, уже не помню.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Может быть, она просто не нужна? Тем более переменная el имеет смысл только внутри вышеуказанного цикла. |
||
| word[el] = "*" | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| a = "топот" | ||
| b = a[:: - 1] # получаем перевёрнутую строку | ||
| if a == b: # сравниваем строки | ||
| print("True") | ||
| else: | ||
| print("False") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| for i in range(1, 101, 15): | ||
| print(i) | ||
| if i % 15 == 0: | ||
| print("FizzBuzz") | ||
| else: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Этот else должен относиться к вышестоящему if. |
||
| if i % 5 == 0: | ||
| print("Buzz") | ||
| else: | ||
| if i % 3 == 0: | ||
| print("Fizz") | ||
| else: | ||
| print(i) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| a = input("Введите число: ") | ||
| numbers = [] | ||
|
|
||
| i = 1 # ввели переменную от которой начать счёт | ||
|
|
||
| for char in a: | ||
| print(f"{i} цифра равна {char}") | ||
| i += 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| a = "" # Строка, куда будем набирать символы. | ||
| sym = input("Введите символ:") | ||
| print(a.isdecimal()) | ||
|
|
||
| while sym != "stop": | ||
| a += sym | ||
| sym = input("Введите символ:") | ||
| print(a) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| a = ("Ты сам-то понял, что написал?", "Аргументируй", "И?") # это кортеж с ответами компъютера | ||
|
|
||
|
|
||
| for i in a: | ||
| print(i) | ||
|
|
||
| b = input("что - то понял, что - то нет: ") | ||
|
|
||
| while b != "хватит": | ||
| print(a[0]) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Теперь надо вместо 0 использовать переменную и менять её, как Вы это делали в файле modul4_2.py |
||
|
|
||
| a = [0] | ||
| a += 1 | ||
| print(a) | ||
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, 7]?
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, 7] - это список, который мы перебираем.
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.
В задании требуется перебрать символы, которые у Вас записаны в переменной word.
Про перебор списка требования нет. Ну и собственно перебор этого списка здесь не делается. Просто вместе с каждой буквой слова "арзамас" зачем-то выводится "[0,7]".