PYTHON
PYTHON INTRODUCTION
• What is Python?
• Python is a high-level, interpreted, and dynamically typed programming
language.
• Known for its simplicity and readability.
• Suitable for beginners and professionals alike.
• Features of Python:
• Open-source and community-driven.
• Extensive libraries and frameworks.
• Platform-independent (cross-platform).
• Versatile: Used in web development, data analysis, AI/ML, automation, and
more.
PYTHON INVENTOR AND MODERN APPLICATIONS
• Inventor of Python:
• Guido van Rossum, released Python in 1991.
• Inspired by ABC language and named after "Monty
Python's Flying Circus."
• Applications of Python Today:
• Web Development (e.g., Django, Flask).
• Data Science and Analytics (e.g., Pandas, NumPy).
• Artificial Intelligence and Machine Learning (e.g.,
TensorFlow, PyTorch).
• Game Development.
• Scripting and Automation.
• Internet of Things (IoT).
PYTHON OPERATORS - ARITHMETIC AND
COMPARISON
•Arithmetic Operators:
•+ (Addition): 5 + 3 = 8
•- (Subtraction): 10 - 4 = 6
•* (Multiplication): 7 * 2 = 14
•/ (Division): 8 / 2 = 4.0
•% (Modulus): 10 % 3 = 1
•** (Exponentiation): 2 ** 3 = 8
•// (Floor Division): 9 // 4 = 2
•Comparison Operators:
•== (Equal to): 5 == 5 (True)
•!= (Not equal to): 5 != 3 (True)
•> (Greater than): 7 > 3 (True)
•< (Less than): 4 < 6 (True)
•>= (Greater than or equal to): 5 >= 5 (True)
•<= (Less than or equal to): 3 <= 7 (True)
PYTHON OPERATORS - ASSIGNMENT AND LOGICA
•Assignment Operators:
•= (Assign): x = 5
•+= (Add and assign): x += 3 (Equivalent to x = x + 3)
•-= (Subtract and assign): x -= 2
•*= (Multiply and assign): x *= 4
•/= (Divide and assign): x /= 2
•Logical Operators:
•and: Returns True if both statements are true. Example: (5 > 3 and 3 > 1) (True)
•or: Returns True if at least one statement is true. Example: (5 < 3 or 3 > 1) (True)
•not: Reverses the result. Example: not(5 > 3) (False)
PYTHON OPERATORS - BITWISE, MEMBERSHIP, AND IDENTITY
•Bitwise Operators:
•& (AND): 5 & 3 = 1
•| (OR): 5 | 3 = 7
•^ (XOR): 5 ^ 3 = 6
•~ (NOT): ~5 = -6
•<< (Left Shift): 5 << 1 = 10
•>> (Right Shift): 5 >> 1 = 2
•Membership Operators:
•in: Returns True if a value exists in a sequence. Example: 'a' in 'apple' (True)
•not in: Returns True if a value does not exist in a sequence. Example: 'x' not in 'apple' (True)
•Identity Operators:
•is: Returns True if both variables are the same object. Example: x = [1, 2, 3]; y = x; x is y (True)
•is not: Returns True if both variables are not the same object. Example: x = [1, 2, 3]; y = [1, 2,
3]; x is not y (True)

Python assignment 1 Biswajit Mohapatra.pptx

  • 1.
  • 2.
    PYTHON INTRODUCTION • Whatis Python? • Python is a high-level, interpreted, and dynamically typed programming language. • Known for its simplicity and readability. • Suitable for beginners and professionals alike. • Features of Python: • Open-source and community-driven. • Extensive libraries and frameworks. • Platform-independent (cross-platform). • Versatile: Used in web development, data analysis, AI/ML, automation, and more.
  • 3.
    PYTHON INVENTOR ANDMODERN APPLICATIONS • Inventor of Python: • Guido van Rossum, released Python in 1991. • Inspired by ABC language and named after "Monty Python's Flying Circus." • Applications of Python Today: • Web Development (e.g., Django, Flask). • Data Science and Analytics (e.g., Pandas, NumPy). • Artificial Intelligence and Machine Learning (e.g., TensorFlow, PyTorch). • Game Development. • Scripting and Automation. • Internet of Things (IoT).
  • 4.
    PYTHON OPERATORS -ARITHMETIC AND COMPARISON •Arithmetic Operators: •+ (Addition): 5 + 3 = 8 •- (Subtraction): 10 - 4 = 6 •* (Multiplication): 7 * 2 = 14 •/ (Division): 8 / 2 = 4.0 •% (Modulus): 10 % 3 = 1 •** (Exponentiation): 2 ** 3 = 8 •// (Floor Division): 9 // 4 = 2 •Comparison Operators: •== (Equal to): 5 == 5 (True) •!= (Not equal to): 5 != 3 (True) •> (Greater than): 7 > 3 (True) •< (Less than): 4 < 6 (True) •>= (Greater than or equal to): 5 >= 5 (True) •<= (Less than or equal to): 3 <= 7 (True)
  • 5.
    PYTHON OPERATORS -ASSIGNMENT AND LOGICA •Assignment Operators: •= (Assign): x = 5 •+= (Add and assign): x += 3 (Equivalent to x = x + 3) •-= (Subtract and assign): x -= 2 •*= (Multiply and assign): x *= 4 •/= (Divide and assign): x /= 2 •Logical Operators: •and: Returns True if both statements are true. Example: (5 > 3 and 3 > 1) (True) •or: Returns True if at least one statement is true. Example: (5 < 3 or 3 > 1) (True) •not: Reverses the result. Example: not(5 > 3) (False)
  • 6.
    PYTHON OPERATORS -BITWISE, MEMBERSHIP, AND IDENTITY •Bitwise Operators: •& (AND): 5 & 3 = 1 •| (OR): 5 | 3 = 7 •^ (XOR): 5 ^ 3 = 6 •~ (NOT): ~5 = -6 •<< (Left Shift): 5 << 1 = 10 •>> (Right Shift): 5 >> 1 = 2 •Membership Operators: •in: Returns True if a value exists in a sequence. Example: 'a' in 'apple' (True) •not in: Returns True if a value does not exist in a sequence. Example: 'x' not in 'apple' (True) •Identity Operators: •is: Returns True if both variables are the same object. Example: x = [1, 2, 3]; y = x; x is y (True) •is not: Returns True if both variables are not the same object. Example: x = [1, 2, 3]; y = [1, 2, 3]; x is not y (True)