[go: up one dir, main page]

0% found this document useful (0 votes)
8 views11 pages

Basic Keywords

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views11 pages

Basic Keywords

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Basic Keywords

Basic Keywords

Keywords:
o Keywords are the reserved words in python.

o We cannot use a keyword as a variable name, function name or any


other identifier.
Basic Keywords

Value Keywords:
True : The True keyword is used as the Boolean true value in Python code.

False : The false keyword is used as the Boolean false value in Python
code.

None : The python None represents no value. In other programming


languages, None is represented as null, none, nil.
Basic Keywords

Operator Keywords:
and : The and keyword is used to determined if both the left and right
operands are truthy or falsy.
or : The or keyword is used to determine if at least one of the operands is
truthy.
not : The not keyword is used to get the opposite Boolean value of a
variable.
in : The in keyword will return True or False indicating whether the
element was found in the container.
Is : The is keyword determines whether two objects are exactly the same
object.
Basic Keywords

Control Flow Keywords:


if : The if statement allows you to write a block of code that gets executed
only if the expression after if is truthy.

elif : The elif statement is only valid after an if statement or another elif.

else : The else statement denotes a block of code that should be executed
only if the other conditional blocks are false.
Basic Keywords

Iteration Keywords:
for : The for keyword is used to start a for loop. It is used to execute a set
of instruction/functions repeatedly when some condition becomes True.

while : The while keyword is used to start a while loop. This loop iterates a
part of the program several times.
Basic Keywords

Loop control Keywords:


break : The break keyword is used exit a loop.

continue : The continue keyword is used when you want to skip to the
next loop iteration.

else : The else keyword specifies code that should be run if the loop exits
normally.
Basic Keywords

Structure Keywords:
def : The def keyword is used to define a function or method of a class.

class: The class keyword is used to define a class.

with : With statement is used to wrap the execution of a block of code


within methods defined by the context manager.

as : The as keyword is used to create as alias while importing a module.


Basic Keywords

Returning Keywords:
return : The return keyword is used inside a function to exit it and return a
value.

Yield : The yield keyword is used inside a function like a return statement,
but yield returns a generator.
Basic Keywords

Import Keywords:
import : The import keyword is used to import modules into the current
namespace.

from : the from keyword is used together with import to import


something specific from a module.

as : The as keyword is used to alias an imported module or tool.


Thank You

You might also like