This repository contains a collection of beginner-friendly Python scripts that demonstrate core programming concepts such as user input, conditionals, exception handling, and object-oriented programming. Each file is self-contained and interactive.
Prompts the user to enter their name and prints a friendly greeting.
📎 Concepts: input(), f-strings, console output 🧪 Example:
Enter your name: Alex
Hello, Alex! Welcome to my portfolio with Python basics.
Checks whether the input number is even or odd, with error handling for invalid inputs. 📎 Concepts: try/except, modulus operator, input conversion 🧪 Example:
Enter a number: 13
The number is odd.
Checks if a player meets a set of conditions based on their sport and number of achievements. Uses or in a conditional statement to evaluate if either criterion is satisfied. 📎 Concepts: logical operators (or), string formatting, conditionals 🧪 Example Output:
Roger Federer meets the criteria! They play Tennis and have 20 achievements.
Safely divides two user-provided numbers and handles zero-division and type errors. 📎 Concepts: try/except/finally, function definition, input handling 🧪 Example:
Enter a numerator: 10
Enter a denominator: 0
Error: Cannot divide by zero.
Processing Complete.
Defines a Vehicle class and creates two instances with different properties. Demonstrates class structure, constructors, and methods. 📎 Concepts: OOP, class attributes and methods, object creation 🧪 Example Output:
Properties of Vehicle:
Model: Honda
Color: white
Max speed: 250
Miles: 20
Capacity: 4
To run any of the scripts:
python script\_name.py
* Variables and data types
* User input and output
* Conditional logic
* Exception handling
* Functions and return values
* Object-oriented programming