форкнуто от main/python-labs
Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
47 строки
1.6 KiB
Markdown
47 строки
1.6 KiB
Markdown
# Общее контрольный вопрос по теме 1
|
|
|
|
Антонов Дмитрий, А-03-23
|
|
|
|
## Вопрос
|
|
|
|
В каком месте инструкции можно написать комментарий?
|
|
|
|
## Ответ
|
|
|
|
Комментарии в python можно вставлять практически в любом месте программы, используя специальный символ - #.
|
|
Нужно помнить, что после символа # до конца сроки текст будет закомментирован. Поэтому не получится прервать комнаду комметарием.
|
|
|
|
|
|
## Пример:
|
|
|
|
```py
|
|
hel#p()
|
|
Traceback (most recent call last):
|
|
File "<pyshell#26>", line 1, in <module>
|
|
hel#p()
|
|
NameError: name 'hel' is not defined. Did you mean: 'hex'?
|
|
hel'''333'''p()
|
|
SyntaxError: invalid syntax
|
|
```
|
|
|
|
```py
|
|
help()#правильный синтаксис
|
|
|
|
Welcome to Python 3.11's help utility!
|
|
|
|
If this is your first time using Python, you should definitely check out
|
|
the tutorial on the internet at https://docs.python.org/3.11/tutorial/.
|
|
|
|
Enter the name of any module, keyword, or topic to get help on writing
|
|
Python programs and using Python modules. To quit this help utility and
|
|
return to the interpreter, just type "quit".
|
|
|
|
To get a list of available modules, keywords, symbols, or topics, type
|
|
"modules", "keywords", "symbols", or "topics". Each module also comes
|
|
with a one-line summary of what it does; to list the modules whose name
|
|
or summary contain a given string such as "spam", type "modules spam".
|
|
|
|
help>
|
|
```
|
|
|