Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Assignment 22: Multithreading

  1. Basic Multithreading:

    • Write a Python program that utilizes multithreading to perform two different tasks concurrently.
    • Use the threading module to create two threads, each performing a specific task.
    • Demonstrate the execution of both threads.
  2. Thread Synchronization:

    • Extend the previous program to showcase thread synchronization.
    • Implement a shared resource (e.g., a counter) and use locks to prevent race conditions.
    • Ensure that the shared resource is updated safely by multiple threads.

Assignment 23: MySQL with Python

  1. Database Connection:

    • Install the mysql-connector-python package.
    • Write a Python script to connect to a MySQL database using the mysql.connector module.
    • Print a confirmation message upon successful connection.
  2. Data Retrieval:

    • Create a table in the MySQL database with sample data (e.g., a simple user table).
    • Write a Python script to query and retrieve data from the table.
    • Print the results.
  3. Data Insertion and Update:

    • Extend the script to insert new records into the table and update existing records.
    • Print the updated results after the operations.

Instructions:

  • Encourage students to use meaningful variable names and provide comments explaining their code.
  • Remind students to handle multithreading synchronization carefully to avoid race conditions.
  • Emphasize the importance of securely managing database connections and handling exceptions.
  • Encourage experimentation with different scenarios to ensure the correctness of the code.
  • Provide feedback on the usage of multithreading and MySQL in their solutions.