WebQuest

Programming with python

Content

20200422113932aRadu.jpg

Comments: 

Comments can be used to prevent execution when testing code. Comments can be used to make the code more readable. They can be used to explain Python code.

A comment in Python starts with the hash character, #, and extends to the end of the physical line. A hash character within a string value is not seen as a comment, though. To be precise, a comment can be written in three ways - entirely on its own line, next to a statement of code, and as a multi-line comment block.

Comments in python.


Conditional Statements: 

Conditional Statement in Python perform different computations or actions depending on whether a specific Boolean constraint evaluates to true or false. Conditional statements are handled by IF statements in Python.

A. If - Else: 

If you have only one statement to execute, one for if, and one for else, you can put it all on the same line. 

example: (One line if- else statement)

a = 2
b = 330
print("A") if a > b else print("B")


B. While: 

While loop repeats the sequence of actions many times until some condition evaluates to False. The condition is given before the loop body and is checked before each execution of the loop body. Typically, the while loop is used when it is impossible to determine the exact number of loop iterations in advance.

Conditional Statements

The Public URL for this WebQuest:
http://zunal.com/webquest.php?w=519363
WebQuest Hits: 316
Save WebQuest as PDF

Ready to go?

Select "Logout" below if you are ready
to end your current session.