Conversation
|
|
||
| list_1 = [1, 45, 2.35, None, 'some_word', 0, 0x1d5e, 0b1011101010111101110001] | ||
| print(list_1) | ||
| for element in list_1: print(type(element)) |
There was a problem hiding this comment.
for element in list_1: print(type(element))
нужно на разных строках
Author
There was a problem hiding this comment.
<class 'int'>
<class 'int'>
<class 'float'>
<class 'NoneType'>
<class 'str'>
<class 'int'>
<class 'int'>
<class 'int'>
у меня выводит на разных строках
| list_2.insert((i - 1), list_2.pop(i)) | ||
| print(list_2) | ||
| i = i + 2 | ||
| print(i) |
| j = 0 | ||
| print(f"Вы выбрали {month_name[(month_number - 1)]}. Месяц {month_name[(month_number - 1)]} относится к времени года" | ||
| f" {sezon[j]}") | ||
|
|
| #4. Пользователь вводит строку из нескольких слов, разделённых пробелами. Вывести каждое слово с новой строки. | ||
| # Строки нужно пронумеровать. Если слово длинное, выводить только первые 10 букв в слове. | ||
| phrase = input("Введите фразу из нескольких слов: ") | ||
| for i, s in enumerate(phrase.split()): print(i + 1, s[0:10]) |
There was a problem hiding this comment.
print(i + 1, s[0:10])
на разных строках
Author
There was a problem hiding this comment.
1 Пользовате
2 вводит
3 строку
4 из
5 нескольких
6 слов,
7 разделённы
8 пробелами
Здесь тоже на разных строках
| o += 1 | ||
| my_range.insert(o, num_input) | ||
| print(my_range) | ||
|
|
There was a problem hiding this comment.
o
переменные с такими именами давать не принято
исправил задание 5, заменил имя переменной
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Основы языка Python
Урок 2. Встроенные типы и операции с ними