alternative
  • Home (current)
  • About
  • Tutorial
    Technologies
    SQL -Structured Query Language
    Python
    Ethical Hacking
    Java
    .net Framework
    Placement Preparation
    Quantitative Aptitude
    View All Tutorial
  • Quiz
    SQL -Structured Query Language
    Quantitative Aptitude
    Java
    View All Quiz Course
  • Q & A
    Quantitative Aptitude
    Java
    View All Q & A course
  • Programs
  • Articles
    Artificial Intelligence & Machine Learning Project
    How to publish your local website on github pages with a custom domain name?
    How to download and install Xampp on Window Operating System ?
    How To Download And Install MySql Workbench
    How to install Pycharm ?
    How to install Python ?
    How to download and install Visual Studio IDE taking an example of C# (C Sharp)
    View All Post
  • Tools
    Program Compiler
    Sql Compiler
    Replace Multiple Text
    Meta Data From Multiple Url
  • Contact
  • User
    Login
    Register

Python - Things to know before proceed - Keyword Tutorial

Python keywords are special keywords that cannot be used as a variable name or another identifier.

Following are the list of Python keywords:

Sr. No

Keyword

Description

  1.  

true

It is Boolean value. If the condition is true, then it will return ‘True’.

  1.  

false

It is a Boolean value. If the condition is false, then it will return ‘False’.

  1.  

and

It is a logical Operator. It is used to check multiple conditions. If any one condition is false, then it will return ‘False’. Otherwise, it will return ‘True’.

  1.  

or

It is a logical Operator. It is used to check multiple conditions. If any one condition is true, then it will return ‘True’. Otherwise, it will return ‘False’.

  1.  

not

It is a logical Operator. It will invert the Boolean value. If it is true, then it will invert it to ‘False’. If it is false, then it will invert it to ‘True’.

  1.  

if

It is used to check conditions. If the condition is true it will execute the block, otherwise, it will skip the block.

  1.  

else

Else condition is used with if condition. Else block will be executed only when, if the condition is false.

  1.  

Elif

It is the same as else if condition. Elif condition can be used between if and else, multiple times. It will check until the true condition is found.

  1.  

break

It is used to terminate the loop iteration and jump out to the end of the loop.

  1.  

continue

It is used to skip the execution of the current iteration and then continue until its ends.

  1.  

none

The none keyword is used as a null value. The none keyword does not represent 0, null or empty.

  1.  

as

‘as’ is used as an alias. It is been used to give a short name or user-defined name while importing a module.

  1.  

assert

The assert keyword is used as debugging tool. It will raise an AssertionError if the condition returns false and print the error message.

  1.  

def

def keyword is used to define function. It is followed by the function name.

  1.  

try

Try keyword is used to handle the exception. If there is an error in a try block, you can define different blocks for different error types.

  1.  

except

Except keyword is used to handle the exception. It will define a block of code to run if a try block raises an error.

  1.  

for

For loop is used for iteration through a sequence like a list, tuples, dictionary, and string.

  1.  

while

While loop is used for iteration until the statement is false

  1.  

from

From keyword is used to import only a specific function or attributes from the module.

  1.  

global

Global keywords make the variable that can be accessed anywhere in the program.

  1.  

import

Import keyword is used to import module for a python project.

  1.  

in

 

  1.  

is

Is keyword is used to test if two variables referring to the same object or not? It will true on same, otherwise false

  1.  

lambda

Lambda keyword is used as an inline function with any no. of argument and a single expression.

  1.  

nonlocal

The nonlocal keyword is used with a variable in the nested loop to show that the Nonlocal variable does not belong to the inner function

  1.  

pass

Pass keyword is used to avoid getting an error, whenever the code is empty

  1.  

raise

Raise keyword is used with an exception to define what type of error to be raised.

  1.  

return

The return keyword is used to return the result value when the code is exited

  1.  

finally

Finally keyword is used to create a block that will always execute, no matter if they try block raises an error or not

  1.  

with

With keyword is used in the exception handling. It makes the code more readable.

  1.  

yield

Yield keyword will end the function and return a generator to the caller

 

Python

Python

  • Introduction
  • Installation and running a first python program
    • How to install Python ?
    • Running 1st Hello World Python Program
    • How to install Pycharm ?
  • Things to know before proceed
    • Escape Characters/Special Characters
    • Syntax ( Indentation, Comments )
    • Variable
    • Datatype
    • Keyword
    • Literals
    • Operator
    • Precedence & Associativity Of Operator
    • Identifiers
    • Ascii, Binary, Octal, Hexadecimal
    • TypeCasting
    • Input, Output Function and Formatting
  • Decision control and looping statement
    • if-else
    • for loop
    • While loop
    • Break Statement
    • Continue Statement
    • Pass Statement
  • Datatype
    • Number
    • List
    • Tuple
    • Dictionary
    • String
    • Set
    • None & Boolean
  • String Method
    • capitalize()
    • upper()
    • lower()
    • swapcase()
    • casefold()
    • count()
    • center()
    • endswith()
    • split()
    • rsplit()
    • title()
    • strip()
    • lstrip()
    • rstrip()
    • find()
    • index()
    • format()
    • encode()
    • expandtabs()
    • format_map()
    • join()
    • ljust()
    • rjust()
    • maketrans()
    • partition()
    • rpartition()
    • translate()
    • splitlines()
    • zfill()
    • isalpha()
    • isalnum()
    • isdecimal()
    • isdigit()
    • isidentifier()
    • islower()
    • isupper()
    • isnumeric()
    • isprintable()
    • isspace()
    • istitle()
  • Python Function
    • Introduction
  • Lambda Function
    • Lambda Function
  • Python Advanced
    • Iterators
    • Module
    • File Handling
    • Exceptional Handling
    • RegEx - Regular Expression
    • Numpy
    • Pandas

About Fresherbell

Best learning portal that provides you great learning experience of various technologies with modern compilation tools and technique

Important Links

Don't hesitate to give us a call or send us a contact form message

Terms & Conditions
Privacy Policy
Contact Us

Social Media

© Untitled. All rights reserved. Demo Images: Unsplash. Design: HTML5 UP.