Curriculum


At Lux Labz, our STEM curriculum offers students the opportunity to explore a variety of exciting and relevant topics that prepare them for the future. Our courses cover everything from computer programming and hardware building to electronics, robotics, and game design. Students learn the fundamentals of coding, create hands-on projects like games and websites, and gain insights into how computers and electronic systems work.

We also introduce students to 3D printing and design, where they can bring their ideas to life, and dive into robotics, allowing them to build and program autonomous machines. In addition, our curriculum includes areas like the Internet of Things (IoT), artificial intelligence, and cybersecurity, where students explore emerging technologies and how they impact the world around us. Each topic is designed to inspire creativity, critical thinking, and problem-solving skills, giving students the tools to innovate and thrive in a tech-driven future.

Sample Training Exercises

Filename Action
python_file_handling.md Preview
python_getting_started.md Preview
python_hello_world.md Preview

Preview: python_file_handling.md

Intermediate Python Training Exercise: File Handling and Data Processing

Overview

In this exercise, you will work on intermediate-level Python skills by handling file input/output and processing data. You will create a Python script that reads data from a CSV file, processes it, and writes the results to a new file. This exercise will help you practice working with file operations and basic data processing techniques.

Prerequisites

  • Basic understanding of Python syntax
  • Familiarity with data types (lists, dictionaries)
  • Basic knowledge of CSV files and how to handle them in Python

Exercise Steps

Step 1: Setup

  1. Create a CSV file named data.csv with the following content:
    Name,Age,Occupation
    Alice,30,Engineer
    Bob,25,Data Scientist
    Charlie,35,Teacher
    
  2. Create a new Python script file named process_data.py in the same directory as data.csv.

Step 2: Read the CSV File

  1. Import the necessary module for handling CSV files:

    import csv
    
  2. Open and read the CSV file:

    with open('data.csv', mode='r') as file:
        reader = csv.DictReader(file)
        data = list(reader)
    
  3. Print the data to verify it has been read correctly:

    print(data)
    

Step 3: Process the Data

  1. Create a new list to store processed data:

    processed_data = []
    
  2. Process each row to add a new field Senior that is True if Age is greater than or equal to 30, otherwise False:

    for row in data:
        row['Senior'] = int(row['Age']) >= 30
        processed_data.append(row)
    

Step 4: Write Data to a New CSV File

  1. Specify the fieldnames including the new Senior field:

    fieldnames = ['Name', 'Age', 'Occupation', 'Senior']
    
  2. Write the processed data to a new CSV file named processed_data.csv:

    with open('processed_data.csv', mode='w', newline='') as file:
        writer = csv.DictWriter(file, fieldnames=fieldnames)
        writer.writeheader()
        writer.writerows(processed_data)
    
  3. Verify the new CSV file has been created and contains the correct data by opening processed_data.csv.

Step 5: Testing and Verification

  1. Run your Python script to ensure it completes without errors and creates the processed_data.csv file.
  2. Check the contents of processed_data.csv to verify that each person’s Senior status has been correctly calculated and recorded.

Conclusion

Congratulations on completing this intermediate-level exercise! You have successfully read, processed, and written data using Python's CSV handling capabilities. This exercise will help you better understand file operations and data processing in Python.

Feel free to modify the CSV file and script to practice with different datasets and processing tasks!

Additional Resources