RUVIDEO
Поделитесь видео 🙏

Comments In Python with example | Types of Comments | #python_02 смотреть онлайн

Comments in python , types_of_comment_in_python
#Comments_in_python
Comments are descriptions that help programmers better understand the intent and functionality of the program.

They are completely ignored by the Python interpreter.

Advantages of Using Comments
Using comments in programs makes our code more understandable. It makes the program more readable which helps us remember why certain blocks of code were written.

Other than that, comments can also be used to ignore some code while testing other blocks of code. This offers a simple way to prevent the execution of some lines or write a quick pseudo-code for the program.


Single-Line Comments in Python
In Python, we use the hash symbol # to write a single-line comment.

Example 1: Writing Single-Line Comments
# printing a string
print('Hello world')
Output

Hello world
Here, the comment is:

# printing a string
This line is ignored by the Python interpreter.

Everything that comes after # is ignored. So, we can also write the above program in a single line as:

print('Hello world') #printing a string
The output of this program will be the same as in Example 1. The interpreter ignores all the text after #.



Multi-Line Comments in Python
Python doesn't offer a separate way to write multiline comments. However, there are other ways to get around this issue.

We can use # at the beginning of each line of comment on multiple lines.

Example 2: Using multiple #
# it is a
# multiline
# comment
Here, each line is treated as a single comment and all of them are ignored.

String Literals for Multi-line Comments
Even though there is no unique way to write multiline comments in Python, we know that the Python interpreter ignores the string literals that are not assigned to a variable.

So, we can even write a single-line comment as:

#this is a comment
'this is an unassigned string as a comment '
Here, we can see that the second line of the program is a string but is not assigned to any variable or function. So, the interpreter ignores the string.

In a similar way, we can use multiline strings (triple quotes) to write multiline comments.

The quotation character can either be ' or ".

Example 3: Using String Literals to write Multi-line Comments
'''

I am a
multiline comment!

'''
print("Hello World")
Here, the multiline string isn't assigned to any variable, so it is ignored by the interpreter. Even though it is not technically a multiline comment, it can be used as one.

Python docstrings
By convention, the triple quotes that appear right after the function, method or class definition are docstrings (documentation strings).

Docstrings are associated with objects and can be accessed using the __doc__ attribute.

To learn more, visit Python docstrings.






contact :-

Instagram -https://www.instagram.com/manoj_coding_lover307/
Fb - https://www.facebook.com/profile.php?id=100028708791223
Twetter - https://twitter.com/Manojme85364154
Website - bit.ly/2WwH5nq

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Comments In Python with example | Types of Comments | #python_02» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.