Statement, Indentation and Comments:
-----------------------------------
Statement:
----------
Python interpreter can execute are called statements. For example, a = 1 is an assignment statement. if statement, for statement, while statement, etc.
Multi-line statement:
the end of a statement is marked by a newline character. But we can make a statement extend over multiple lines with the line continuation character (\).
ex:
a = 1 + 2 + 3 + \
4 + 5 + 6 + \
7 + 8 + 9
line continuation is implied inside parentheses ( ), brackets [ ], and braces { }.
ex:
a = (1 + 2 + 3 +
4 + 5 + 6 +
7 + 8 + 9)
Indentation:
------------
Most of the programming languages like C, C++, and Java use braces { } to define a block of code. Python, however, uses indentation.
A code block (body of a function, loop, etc.) starts with indentation and ends with the first unindented line. The amount of indentation is up to you, but it must be consistent throughout that block.
ex:
for i in range(1,11):
print(i)
if i == 5:
break
Comments:
---------
Comments are very important while writing a program. They describe what is going on inside a program, so that a person looking at the source code does not have a hard time figuring it out.
we use the hash (#) symbol to start writing a comment.
Multi-line comments
We can have comments that extend up to multiple lines. One way is to use the hash(#) symbol at the beginning of each line.
Another way of doing this is to use triple quotes, either ''' or """.
These triple quotes are generally used for multi-line strings. But they can be used as a multi-line comment as well. Unless they are not docstrings, they do not generate any extra code.
ex:
"""This is also a
perfect example of
multi-line comments"""
Docstrings in Python:
---------------------
A docstring is short for documentation string.
Python docstrings (documentation strings) are the string literals that appear right after the definition of a function, method, class, or module.
ex:
def double(num):
"""Function to double the value"""
return 2*num
__________________ API Automation _________________
➡️ Rest Assured Using Java → • Rest Assured
➡️ Karate Framework using Maven → • Karate Framework Using Maven Project
_____________ Programing Language ____________________
➡️ Basic Python → • Basic Python
➡️ Core Java → • CoreJava
___________ Performances Testing ___________________
➡️ JMeter Beginner → • JMeter Beginner
➡️ Locust Beginner → • Locust
___________ Git and GitHub _____________________________
➡️ Git and GitHub Beginner → • Git and GitHub Beginner
_____________Manual Testing ____________________
➡️ Manual Testing → • Manual Testing
______________Automation Testing __________________
➡️ Selenium Cucumber Framework using Java → • Selenium Cucumber BDD Framework with Java ...
➡️ Robot Framework with Python → • Python With Robot Framework
➡️ Beginner Karate Framework using Intellij → • Karate Framework Beginner
➡️ Karate Framework with Gradle using eclipse → • Karate Framework using Gradle Project
➡️ Basic Selenium WebDriver using Java → • Selenium WebDriver
➡️ TestNG Framework → • TestNG Framework
➡️ Robot Framework with RIDE → • RIDE With Robot Framework
________________ Beginner Jenkins ____________________
➡️ Beginner Jenkins → • Beginner Jenkins
Nesta página do site você pode assistir ao vídeo on-line Basic Python 6: Statement, Indentation and Comments duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Testing Tutorialspoint 13 Setembro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 172 vezes e gostou 6 espectadores. Boa visualização!