Python Programming - Unit 1 to 3 Summary (BCA - University of Mysore)
UNIT 1: Python Basics
UNIT 1: Python Programming - Summary
- Python is a high-level, interpreted, object-oriented language.
- Developed by Guido van Rossum (1991).
- Features: portable, dynamic typing, open-source, extensive libraries.
- Applications: AI, web dev, automation, finance, etc.
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
UNIT 2: Data Types and Structures
UNIT 2: Strings, Lists, Tuples, Dictionaries & Sets
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)
- Immutable, defined with ()
- Methods: count(), index()
SETS:
- Unordered, no duplicates: {1,2,3}
- Methods: add(), discard(), union(), intersection(), difference(), issubset()
UNIT 3: OOP, GUI, DB, Data Analysis
UNIT 3: Classes, GUI, Database, Data Analysis
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()