Python Unit1 to 3 Summary
Python Unit1 to 3 Summary
Basics:
- Identifiers, Keywords, Variables (dynamic typing)
- Data Types: int, float, str, bool, None
- Operators: Arithmetic, Assignment, Comparison, Logical, Bitwise, Identity, Membership
Control Flow:
- if, if-else, if-elif-else, loops (for, while), break, continue
Functions:
- Built-in and User-defined functions
- def keyword, recursion, argument types (positional, default, keyword)
- Scope: Local, Global
Exception Handling:
- try, except, else, finally
- Errors like ZeroDivisionError, ValueError
Python Libraries:
- Modules like math, random, datetime
STRINGS:
- Immutable, defined with '', "", ''' '''
- Methods: upper(), lower(), split(), replace(), find(), isdigit(), etc.
- Slicing: s[1:4], s[::-1]
LISTS:
- Mutable, defined with []
- Methods: append(), extend(), insert(), remove(), pop(), sort(), reverse()
- Used for stacks and queues
DICTIONARIES:
- Key-value pairs: {"a":1}
- Methods: keys(), values(), items(), get(), update(), pop()
TUPLES:
Python Programming - Unit 1 to 3 Summary (BCA - University of Mysore)
SETS:
- Unordered, no duplicates: {1,2,3}
- Methods: add(), discard(), union(), intersection(), difference(), issubset()
OOP:
- Class, Object, Constructor (__init__), Method, Inheritance, Encapsulation (private vars), Polymorphism (overloading)
INHERITANCE TYPES:
- Single, Multiple, Multilevel, Multipath
GUI (Tkinter):
- Widgets: Label, Button, Entry
- Layouts: pack(), grid(), place()
- GUI window: mw = Tk(), mw.mainloop()
SQLite3 (Database):
- Steps: import, connect, cursor, execute, commit, fetch, close
- CRUD: CREATE, INSERT, SELECT, UPDATE, DELETE
NumPy:
- Arrays: array(), zeros(), ones(), arange(), linspace(), random.rand()
- Ops: add, subtract, multiply, divide, reshape, transpose, concatenate
- Stats: sum, mean, median, std, min, max
Pandas:
- Series (1D), DataFrame (2D)
- Creation: from list, dict, tuple, CSV, Excel
- Operations: filter, drop, sort, merge, join
Matplotlib:
- Plots: line, bar, hist, pie
- plt.plot(), plt.bar(), plt.hist(), plt.pie()