0% found this document useful (0 votes)
9 views8 pages

Python Data Types and OOP Basics

Uploaded by

mmumar.mct
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)
9 views8 pages

Python Data Types and OOP Basics

Uploaded by

mmumar.mct
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

Python Data Types

• Numeric Types: int, float, complex


• String Type: str
• Boolean Type: True, False
Assigning Variables
• Variables store data.
• Rules:
• - Cannot start with number
• - No spaces
• - Case sensitive
Python Keywords
• Reserved words you cannot use as variables.
• Examples: if, else, for, while, class, import
String Functions and Methods
• Common Methods:
• .upper(), .lower(), .title(), .strip(),
• .replace(), .split(), len()
Mathematical Operators
• + Addition
• - Subtraction
• * Multiplication
• / Division
• // Floor division
• % Modulus
• ** Exponent
Mathematical Functions
• From math module:
• sqrt(), pow(), ceil(), floor(), sin(), cos(), log(),
factorial()
Object-Oriented Programming
(OOP)
• Concepts:
• Class, Object, Encapsulation,
• Inheritance, Polymorphism
OOP Example
• class Student:
• def __init__(self, name, age):
• [Link] = name
• [Link] = age

• def display(self):
• print(name, age)

You might also like