• Job Alert: Scaler Data Jobs
  • sclerdg@gmail.com
  • New Delhi
WhatsApp Group Join Now
Telegram Group Join Now
Instagram Group Join Now

Python: A Comprehensive Guide for Beginners

Introduction to Python

Python and python operators

Python Guide for Beginners

Python Operators

In Python Introduction, operators are special symbols or keywords used to perform operations on values or variables. These operations can range from simple arithmetic to logical comparisons and data manipulations. Operators allow you to build expressions and logic within your Python programs.

Types of Operators

  1. Arithmetic Operators  (+,-,*,/,%)
  2. Comparison Operators (<,<=,>=,==,!=)
  3. Logical Operators  (AND, OR, NOT)
  4. Bitwise Operators (&,|,<<,>>,-,^)
  5. Assignment Operators  (=,+=,-=,%=)
  6. Identity Operators and Membership Operators. These are the operators majorly used in Python Introduction 

Data Types in Python

  • There are many types of data types in Python but some are commonly used  like ( Int, Float, String, Boolen, Complex).
  • Integer
  • Float
  • String
  • Boolen
  • Complex
  • Bytes
  • Bytearray
  • Range
  • List
  • Tuple
  • Set
  • Frozenset
  • Dict
  • None

Explanation of Data Types

  1. Integer Data Type:

 

We can use the Int data type to represent the whole numbers (integral value) Example If a=10



   2. Float Data Type:

We can use float data type to represent the decimal values.


 

3. String Data Type:

Str represents the String data type. A String is a sequence of characters.

Note: If Str is empty str then, it should be false.

4. Boolen Data Type:

We represent either True or False. Any non-zero number should be true.

5. Complex Data Type:

Complex data type represents the numbers which is written in form of a+bj or a-bj.

 

 

ARITHEMATIC OPERATOR IN PYTHON

Arithmetic operators used to perform mathematical calculation using below symbols.

SituationsOperatorDescriptionSyntax with example
1+Adding two operandsa+b (3+2=5)
2Subtract two operandsa-b (3-2=1)
3*Multiply two operandsa*b  (3*2=6)
4/Divide the operandsa/b  (3/2=1.5)
5//Use to remove decimala//b (3/2=1)
6**Square Roota**b (3**2=9)
7%Find out reminder valuea%b (3%2=1)

 

Leave a Reply

Your email address will not be published. Required fields are marked *