A template repository for creating Python coding examples and exercises for RobotX Workshops students.
cd 01_basics
python variables.pypython variables.pyComplete each folder in numerical order:
- 01_basics → Master fundamental concepts
- 02_functions → Learn to write reusable code
- 03_data_structures → Organize and manipulate data
- 04_file_handling → Work with external files
- 05_packages → Manage external libraries and dependencies
- 06_object_oriented → Build complex applications
- 07_projects → Apply everything you've learned in this repository.
- Click the "Use this template" button at the top of this repository
- Choose "Create a new repository"
- Name your repository (e.g.,
python-exercises-yourname) - Make sure it's set to Public (so instructors can review your work)
- Click "Create repository from template"
# Replace 'yourusername' and 'your-repo-name' with your actual GitHub username and repository name
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name- Open the folder in VS Code
- Install the Python extension if you haven't already
- Set up a Python interpreter (Python 3.8+ recommended)
-
Make sure Python 3.8+ is installed on your system
-
Create a virtual environment (recommended for package management exercises):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Before working on the package management exercises:
cd 05_packages
python -m venv package_env
source package_env/bin/activate # On Windows: package_env\Scripts\activate
pip install -r requirements.txtThe exercises are organized in numbered folders that should be completed in order. Each folder builds on concepts from the previous ones:
your-repo-name/
├── README.md # This file
├── .gitignore # Git ignore file
├── 01_basics/ # START HERE - Basic Python concepts
│ ├── variables.py
│ ├── data_types.py
│ ├── conditionals.py
│ └── loops.py
├── 02_functions/ # Function exercises
│ ├── basic_functions.py
│ ├── parameters.py
│ └── return_values.py
├── 03_data_structures/ # Lists, dictionaries, etc.
│ ├── lists.py
│ ├── dictionaries.py
│ └── sets_tuples.py
├── 04_file_handling/ # Working with files
│ ├── reading_files.py
│ ├── writing_files.py
│ └── sample_data.txt
├── 05_packages/ # Package management and dependencies
│ ├── pip_basics.py
│ ├── package_basics.py
│ ├── virtual_environments.py
│ └── requirements.txt
├── 06_object_oriented/ # OOP concepts
│ ├── classes.py
│ ├── inheritance.py
│ └── encapsulation.py
├── 07_projects/ # Final projects combining all concepts
│ ├── calculator.py
│ ├── word_counter.py
│ └── simple_game.py
└── bonus_exercise/ # Advanced data analysis challenge
├── robot_data_analysis.ipynb
└── robot_sensor_data.csv
- Create the folder structure shown above
- For each Python file, include:
- A docstring at the top explaining the exercise
- Clear comments explaining each section
- Your implementation of the required functions/classes
- Test cases or example usage
"""
Exercise: [Exercise Name]
Description: [Brief description of what this exercise covers]
Author: [Your Name]
Date: [Date]
"""
# TODO: Complete the following exercises
def example_function():
"""
Description of what this function should do.
Returns:
[Description of return value]
"""
# Your code here
pass
# Test your function
if __name__ == "__main__":
# Add test cases here
print("Testing example_function...")
# result = example_function()
# print(f"Result: {result}")Master fundamental Python concepts before moving on:
- variables.py: Variable declaration, assignment, and scope
- data_types.py: Strings, integers, floats, booleans
- conditionals.py: if/elif/else statements
- loops.py: for loops, while loops, loop control
Build on basics to create reusable code:
- basic_functions.py: Function definition and calling
- parameters.py: Parameters, arguments, default values
- return_values.py: Return statements and multiple return values
Learn to organize and manipulate data:
- lists.py: List operations, methods, list comprehensions
- dictionaries.py: Dictionary operations, methods, iteration
- sets_tuples.py: Set and tuple operations
Work with external data and files:
- reading_files.py: Reading from text files
- writing_files.py: Writing to text files
- sample_data.txt: Sample data file for exercises
Learn to use external libraries and manage dependencies:
- pip_basics.py: Learn essential pip commands and check installations
- package_basics.py: Install and use your first external package (colorama)
- virtual_environments.py: Create simple requirements.txt files
- requirements.txt: Sample dependency file for practice
Create complex, organized programs:
- classes.py: Class definition, constructors, methods
- inheritance.py: Class inheritance and method overriding
- encapsulation.py: Private attributes and methods
Apply everything you've learned:
- calculator.py: Feature-rich calculator (combines functions, conditionals, loops)
- word_counter.py: Text analysis tool (combines file handling, data structures, packages)
- simple_game.py: Interactive game (combines OOP, user input, game logic)
Real-world Python development relies heavily on external packages! The 05_packages/ folder teaches essential skills:
- Package Installation: Use
pipto install powerful libraries likerequests,pandas,matplotlib - Virtual Environments: Isolate project dependencies to avoid conflicts
- Requirements Files: Share and reproduce project environments with
requirements.txt - Dependency Management: Understand versioning and compatibility
🎯 Professional Development: Every Python project uses external packages
🛡️ Environment Safety: Virtual environments prevent dependency conflicts
🤝 Team Collaboration: Requirements files ensure everyone has the same setup
📦 Package Ecosystem: Access to 400,000+ packages on PyPI
Complete the package management exercises before moving to OOP - you'll use these skills in the final projects!
- Follow the Order: The numbered folders build on each other - don't skip ahead!
- Complete All TODOs: Each file has multiple TODO sections - finish them all
- Test Frequently: Run each file after completing TODOs to verify your code works
- Read Error Messages: They're helpful guides to fix your code
- Use the Built-in Tests: Each file has test functions to validate your implementations
- Take Your Time: Understanding is more important than speed
- Practice Regularly: Consistency is key to learning programming
- Create Virtual Environments: Use
python -m venv venvfor each new project - Ask Questions: Don't hesitate to ask instructors for help
Make frequent commits as you complete exercises:
git add .
git commit -m "Complete variables.py exercises"
git push origin main-
Ensure all exercises are completed
-
Test all your code to make sure it works
-
Update this README with any additional notes about your solutions
-
Make a final commit:
git add . git commit -m "Final submission - all exercises completed" git push origin main
- Documentation: Python Official Documentation
- Tutorial: Python.org Tutorial
- Interactive Learning: Python.org Beginner's Guide
- Ask Instructors: Don't hesitate to reach out during workshops
Use this checklist to track your progress:
-
variables.py- Variable exercises completed -
data_types.py- Data type exercises completed -
conditionals.py- Conditional logic exercises completed -
loops.py- Loop exercises completed
-
basic_functions.py- Basic function exercises completed -
parameters.py- Parameter exercises completed -
return_values.py- Return value exercises completed
-
lists.py- List exercises completed -
dictionaries.py- Dictionary exercises completed -
sets_tuples.py- Set and tuple exercises completed
-
reading_files.py- File reading exercises completed -
writing_files.py- File writing exercises completed
-
pip_basics.py- Basic pip commands learned -
package_basics.py- First external package installed and used -
virtual_environments.py- Requirements.txt file created
-
classes.py- Class exercises completed -
inheritance.py- Inheritance exercises completed -
encapsulation.py- Encapsulation exercises completed
-
calculator.py- Calculator project completed -
word_counter.py- Word counter project completed -
simple_game.py- Game project completed
-
robot_data_analysis.ipynb- Data visualization and analysis completed
For advanced students who want extra challenge!
Located in the bonus_exercise/ folder, this Jupyter notebook exercise teaches:
- Data Analysis: Load and analyze real robot sensor data from CSV files
- Statistical Methods: Calculate means, medians, and detect anomalies
- Data Visualization: Create charts, histograms, and correlation heatmaps
- Jupyter Notebooks: Interactive data science workflows
- Python Libraries: pandas, matplotlib, seaborn, numpy
-
Install required packages:
cd bonus_exercise/ pip install -r requirements.txt -
Launch Jupyter:
jupyter notebook robot_data_analysis.ipynb
-
Complete all TODO sections in the notebook cells
Skills Gained: Professional data analysis techniques used in robotics and AI!
Good luck with your Python learning journey! 🐍✨