r/PythonLearning • u/timepassr • 2d ago
Help Request Help needed for schools python learning
so a little of context i have computer science as a subject in grade 12 , and in it i have to study python , sql , stack and python connectivity with sql . i have managed to study sql but im struggling with python all i know is print("hello world") , i dont know if this is the right place to post this but help will be really appreciated . also i cant give it much time sadly coz i have subjects like physics chem and maths hanging in my neck . max i can give is 45 mins a day and i have to do it in under a month .
these are all the topics i need to learn
- Basics: Tokens, keywords, identifiers, literals, variables, data types, operators, and type conversion.
- Control Flow: Conditional statements (
if,elif,else) and loops (for,while,break,continue). - Strings: Indexing, slicing, traversal, and built-in string methods.
- Lists, Tuples, and Dictionaries: Creation, indexing, slicing, mutability vs. immutability, traversal, and built-in functions/methods.
- Standard Modules: Importing and using
math,random, andstatistics.
- Functions
- Types of Functions: Built-in functions, functions defined in modules, and user-defined functions (
def). - Parameters & Arguments: Positional arguments, default parameters, and keyword (named) arguments.
- Return Values: Returning single or multiple values (
returnstatement) vs. void functions. - Scope of Variables: Global scope vs. local scope and the
globalkeyword.
- Exception Handling
- Error Types: Syntax errors, runtime errors (exceptions), and logical errors.
- Built-in Exceptions:
ZeroDivisionError,TypeError,ValueError,IndexError,KeyError,FileNotFoundError,IOError, etc. - Handling Blocks:
try,except,else, andfinallyclauses, along withraiseandassertstatements.
- File Handling
- File Types: Text files (
.txt), binary files (.dat), and CSV files (.csv). - General File Operations:
open(),close(),withstatement, and file access modes (r,r+,w,w+,a,a+,rb,wb,ab, etc.). - Text Files: Reading (
read(),readline(),readlines()), writing (write(),writelines()), and file pointer manipulation (seek(),tell()). - Binary Files: Serialization/deserialization using the
picklemodule (pickle.dump()andpickle.load()). - CSV Files: Reading and writing tabular data using the
csvmodule (csv.reader(),csv.writer(),writerow(),writerows()).
- Data Structures (Stack)
- Stack Concepts: Linear data structure and LIFO (Last-In, First-Out) principle.
- Stack Operations: Implementation using Python lists (
pushviaappend(),popviapop(),peek/display, and underflow/overflow checks).
- Python–Database Connectivity
- MySQL Interface: Connecting Python to a MySQL database using
mysql.connector. - Query Execution:
connect(),cursor(),execute(), parameterized queries (%sor.format()),commit(),fetchone(),fetchmany(),fetchall(), androwcount.
THANKS A LOT FOR READING
1
u/STEM-Mentor 1d ago
Try
https://www.learnpython.org/
This can teach you most of those topics in small code chunks. Then, as the other commenter said, try writing it on your own. These days AI can write extremely good Python code. But you need to know what the individual lines of code do. So, when you try on your own, you can try writing the code in Google Colab and then when the code breaks, use Gemini (AI agent of Google) to explain the mistake. Gemini will readily give you the corrected code, but for your learning, you may explicitly ask it not to give the corrected code but just to explain the mistake and give you some hint.
Once you are able to iterate like this for multiple problems, your Python knowledge and understanding will improve.
2
u/realakku 2d ago
These are not that hard bro, watch some tutorials try typing the code that you remember if it breaks try to debug it yourself you will learn it pretty quickly
Everyone one starts like this
1
u/Careful_Exercise_956 1d ago
I think pickle serialization is unsafe.
1
u/Capital_Quality_6110 1d ago
The best way is by practising. Take a little project like a guess the number game, imagine the logic and the steps the computer will do to evaluate the game then try to translate it to python. For example when you say: the computer decides if the answer is true or false, you will searche controll flow using if elif else statements. I am a 16 year-old teenager and this is how I learned python.