Ahmed Elmalla
Ahmed Elmalla
Python Tutor Mobile Developer Web Developer Product Manager Product Manager Data Analyst
Ahmed Elmalla

Blog

OOP Object oriented Programing | Data Structure | Python Classes | Python Tutor | USA

OOP Object oriented Programing | Data Structure | Python Classes | Python Tutor | USA

The post lists all the lessons & resources needed by my OOP python students:

List of classes & the asscociated slides & codes  :

1) Class 1

     a) Video : Part 1, Part 2 , 

     b) Files: G Drive

     c) Class Code: python

     d) Excercises : python

 

2) Assignment (-):

     a) Video : Assignment revision

     b) Files: 

     c) Class Code: python

     d) Excercises : 

 

3) Class 2 (4 Sept ):

     a) Video : Part 1Part 2 , Part 3, Part 4, Part 5

     b) Files: G-Drive

     c) Class Code: Application / utility 

     d) Excercises : python

 

4) Class 3 (11 Sept ):

     a) Video : Part 1Part 2 , Part 3Part 4

     b) Files: G-Drive

     c) Class Code: Application 

     d) Excercises : python

 

5) Class 4 (15 Sept ):

     a) Video : Part 1Part 2 , Part 3, part 4 (private)

     b) Files: G-Drive

     c) Class Code: challange

     d) Excercises : N/A

 

6) Class 5 (25 Sept ):

     a) Video : Part 1 (private), Part 2 , Part 3, part 4, part 5

     b) Files: G-Drive

     c) Class Code: printAccount Excercise, LA4_solution_attempt

     d) Excercises : N/A

 

7) Class 6 (2 Oct ):

     a) Video : Part 1Part 2 , Part 3part 4

     b) Files: G-Drive

     c) Class Code: printAccount Excercisezoo class

     d) Excercises : G-Drive

 

8) Class 7 (12 Oct ):

     a) Video : Part 1 (Building Library Database Exercise), 

                      Part 2 (Extending search and Raising Exceptions) 

     b) Files: n/A

     c) Class Code: printAccount Excercise

     d) Excercises : N/A

 

9) Class 8 (30 Oct ):

     a) Video : Part 1 (Troubleshooting Library Search GUI App), 

                      Part 2 (Remarks on Searching list Class + Exceptions Class) 

     b) Files: GDrive

     c) Class Code: GUI TKinter App for the libarary , Video_games.txt

     d) Excercises : Video Games Store

 

10) Class 9 (10 Nov. ):

     a) Class Summary: 

  1. In this coding session, we delved into the concept of named tuples in Python, understanding how they provide a more readable and accessible way to work with structured data compared to regular tuples.

  2. The code focused on creating two classes, one for tables and another for customers in a restaurant scenario. We explored how named tuples were utilized to improve code readability and make elements accessible by name, enhancing the overall organization of the code.

  3. The discussion also touched upon the difference between traditional tuples and named tuples, highlighting the advantage of using named tuples for scenarios where clarity and readability in code are crucial, such as in managing restaurant-related data structures.

  4. The discussion involves a coding session where the user and the instructor explore advanced Python topics, including the use of named tuples, private variables, and decorators.
  5. The user demonstrates a GUI application involving classes, specifically addressing a search functionality issue in the code.
  6. The conversation delves into collaborative coding practices, discussing how multiple programmers coordinate their efforts, handle exceptions, and implement unit testing for code verification.
  7. The conversation covers a Python coding session where the user and the instructor explore advanced Python topics, including named tuples, private variables, and decorators.
  8. A GUI application is discussed, focusing on a search functionality issue within the code. The conversation touches upon collaborative coding practices, unit testing, and the role of dedicated testers in software development.
  9. The instructor explains the use of decorators, specifically the property decorator, to simplify code by eliminating the need for explicit set and get methods. The concept of read-only attributes and the integration of default dictionaries for handling collections are also highlighted.

     b) Video : Part 1 (Exploring Named Tuples + Exercise LA11), 

                      Part 2 (Unit Testing + Project Collaboration) 

                      Part 3 (R) 

 

     c) Files: GDrive

     d) Class Code: Unit Test

     e) Excercises : n/A

 

11) Class 10 (13 Nov. ):

    a) Class Summary: 

  1. The discussion covered diverse topics, ranging from class exercises and delivery times to Python programming and cybersecurity concepts.
  2. Key points included the significance of automation in cybersecurity tasks, the vulnerabilities of PHP, and the use of Google dorks to find exposed information on the internet.
  3. Specific feedback on a Python project suggested considering the use of a default dictionary instead of a regular dictionary or list for a library's collection, emphasizing the importance of aligning with project requirements for optimal results.
  4. The conversation focuses on developing a program for parsing CSV files to organize app data efficiently, emphasizing the importance of CSV readers, dictionaries, and for loops.

  5. Key concepts include extracting app details, utilizing categories as dictionary keys, and employing programming techniques to manage and store information effectively.

  6. The discussion provides insights into coding practices for handling CSV data, fostering an understanding of how to navigate and organize app-related information using Python.

  7. The discussion covers CSV file handling, specifically using the CSV reader to extract information and create objects of a defined class (app class) for further data organization.
  8. The importance of class variables and dictionaries is emphasized for categorizing information based on different criteria such as marketing category, price, and rating.
  9. Tips are provided for handling float values when categorizing, including converting them to integers for effective organization within dictionaries.

     b) Video : Part 1 (Mastering Python for Cybersecurity), 

                      Part 2 (Mastering CSV File Parsing: Efficient App Data Organization with Python Programming) 

                      Part 3 (Organizing Data with Class Variables and Dictionaries | Python Tips and Tricks)

     c) Files: GDrive

     d) Class Code: File Integrity Check & Dumping dict to json 

     e) Excercises : N/A

 

12) Class 11 (20 Nov. ):

    a) Class Summary: 

  1. AI Applications in Medicine: The conversation delves into AI applications in the medical field, specifically in predicting diseases based on vital signs. The focus is on utilizing large datasets to make predictions about health conditions, such as diabetes and heart disease, with the potential for early detection.

  2. Self-Improvement in AI: The discussion touches on the idea that AI has the potential for self-improvement. Large companies are mentioned as having the resources to enable AI to fix its own bugs and even develop its own language. The role of AI in generating code and evolving over time is highlighted, although it's noted that such capabilities are currently limited to major corporations.

  3. Python, Git, and Flask in AI Development: The conversation shifts to the technical aspects, mentioning the use of Python programming language, Git for version control, and Flask as a framework for building APIs. The focus is on how these tools are employed in developing AI applications, including predictive models for health conditions and generative AI for tasks like image creation.

  4. Effective Learning Techniques: The discussion emphasizes the importance of incorporating breaks in learning sessions to prevent cognitive overload, providing insights into optimal learning strategies.

  5. Web Security Insights: The conversation delves into Google dorks, revealing techniques to identify vulnerabilities and secure websites against potential threats, with a focus on protecting sensitive information.

  6. Practical Coding Approach: The speaker advises a systematic coding approach, covering the creation of class structures, incremental testing, and the development of a user-friendly menu interface for an ongoing project, highlighting the importance of a structured coding process.

  7. Code Review and Corrections:

    • The discussion involves reviewing and correcting Python code for a GUI application.
    • Attention is given to details like button functionality and ensuring alignment with project specifications.
  8. Command Implementation:

    • The conversation emphasizes the importance of implementing specific commands for buttons in the GUI.
    • Each button is expected to trigger a specific method, and the correct command names are derived from comments in the professor's code.
  9. Event-Driven Programming:

    • The code is structured to follow event-driven programming principles, where user actions (events) trigger responses in the program.
    • The main loop is crucial for the application to respond to user clicks and events.
  10. GUI Debugging and Troubleshooting in Python TKinter: A Step-by-Step Guide

    • Explore the intricacies of fixing common errors in Python TKinter GUI development.
    • Understand the importance of proper code indentation and resolving undefined references.
    • Learn effective strategies for enhancing the functionality of a graphical user interface.
  11. Optimizing Python TKinter Applications: Importing Strategies for Efficient Code Execution

    • Gain insights into the correct way to import modules and classes in Python TKinter.
    • Discover the impact of importing specific components versus importing the entire module.
    • Ensure smooth execution and avoid errors by following best practices in module imports.
  12. Unveiling the Mystery of Blank GUI Screens: Resolving UI Display Issues in Python

    • Tackle challenges related to blank GUI screens in Python applications.
    • Delve into the nuances of configuring layout parameters such as side, top, and bottom.
    • Follow a systematic approach to identify and rectify common UI display problems in Python TKinter.

 

 

     b) Video : Part 1 (Exploring the Future of AI: Applications in Medicine, Self-Improvement, and Python Development), 

                      Part 2 (Tkinter App Store + Web Security Insights) 

                      Part 3 (Python GUI Development: Code Review, Command Implementation, and Event-Driven Programming Discussion)

                      Part 4 (Mastering Python TKinter: Debugging GUIs, Optimizing Imports, and Resolving Blank Screen Issues)                   

     c) Files: GDrive

     d) Class Code: n/A 

     e) Excercises : N/A

 

13) Class 12 (25 Nov. ):

    a) Class Summary: 

  1. GUI Development and Troubleshooting:

    • Discusses the development of a graphical user interface (GUI) for a project.
    • Highlights the importance of troubleshooting and understanding error messages, especially related to GUI elements.
  2. CSV File Handling:

    • Demonstrates the process of reading data from a CSV file using Python, including the use of the CSV module.
    • Emphasizes the need to handle headers in CSV files and skip unnecessary information.
  3. Object-Oriented Programming (OOP):

    • Mentions the creation of objects based on a class (e.g., the app class) and passing relevant data to these objects.
  4. CSV File Processing: The code involves reading data from a CSV file, specifically focusing on skipping the header and extracting relevant information row by row for further processing.

  5. Data Conversion and Dictionary Creation: The script converts string data from the CSV file into appropriate formats, such as converting price and rating values to floats. It then constructs dictionaries using these values, organizing the apps based on categories, ratings, and prices.

  6. Error Handling for Free Apps: A key consideration is handling the scenario where the price of an app is marked as "free." The code incorporates an if-else statement to account for this, ensuring that the price is set to zero when the app is marked as free to prevent conversion errors.

  7. Understanding Class Variables and Local Variables   Class variables are defined within the class and belong to the class itself. They can be accessed using the class name and the variable name.   Local variables are defined within a method and only exist within the scope of that method. They can be accessed directly using the variable name.

  8. Implementing a Library Class with a Default Dictionary  The Library class represents a collection of books. It maintains a default dictionary named books to store book objects. The default dictionary ensures that any key not present in the dictionary will be assigned a default value of a Book object.

  9. Enhancing the Library Class  The Library class is enhanced to include a country attribute for each book. The country attribute is extracted from the text file and added to the corresponding book object. The enhanced Library class provides a more comprehensive representation of book collections.

     b) Video : Part 1 (Mastering GUI Development, CSV File Handling, and Troubleshooting), 

                      Part 2 (CSV Data Processing and Dictionary Construction in Python: Building Structured App Information) 

                      Part 3 (Enhancing Book Management with a Default Dictionary: A Step-by-Step Guide to Implementing a Library Class)                 

     c) Files: GDrive

     d) Class Code: n/A 

     e) Excercises : N/A

 

14) Class 13 (27 Nov. ):

    a) Class Summary: 

  1. Debugging the GUI:

    • Issue: Ratings are shown as numbers instead of stars in the GUI.
    • Solution: Introduced the createAsct function to convert numbers to star strings.
    • Implementation: Integrated createAsct into the GUI, resolving the issue and displaying stars for ratings.
  2. Implementing the createAsct Function:

    • Definition: createAsct takes a number and returns a string of stars.
    • Mechanism: Utilizes string multiplication to generate a star string based on the input number.
    • Application: Implemented createAsct in the GUI to visually represent ratings with stars.
  3. Integrating createAsct Function into the GUI:

    • Execution: createAsct is invoked within the GUI to transform numeric ratings into star strings.
    • Outcome: Ratings are now accurately displayed in the GUI using star symbols, enhancing visual representation.
  4. The tutor and student collaboratively enhance a Python program, focusing on sorting ratings within a for loop to address the issue of unsorted data.
  5. The practical demonstration includes creating a GUI button and resolving variable scope errors, emphasizing the importance of meaningful variable names and effective debugging practices.
  6. The discussion extends to improving the program by incorporating dollar signs into prices, with the tutor suggesting the use of a range to generate the desired output.
  7. Understanding the Use of Mechanize Library and Proxies:

    • Introduced the Mechanize library, which allows you to act as a browser in Python and retrieve the source code of a webpage.
    • Highlighted the importance of using proxies in cybersecurity to hide your IP address when interacting with websites.
    • Discussed the significance of examining the source code, particularly HTML and JavaScript, for troubleshooting and understanding security issues.
  8. Practical Implementation - Creating a Range Function:

    • Demonstrated the creation of a function that converts a given number into a formatted range, considering dollar signs and decimal places.
    • Emphasized the use of formulas and dynamic programming instead of relying on if statements for efficient and scalable code.
  9. Integration into GUI Application:

    • Integrated the range function into a GUI application, replacing the displayed price with the calculated range.
    • Emphasized the importance of understanding variable scope and returning values from functions.
  10. Upcoming Focus on Cybersecurity:

    • Introduced the concept of web scraping and using proxies for security purposes.
    • Highlighted the need to understand and manipulate source code to gather valuable information.
    • Discussed the relevance of Python programming skills in the context of cybersecurity tasks.
  11. Future Session Planning:

    • Scheduled a future session to delve deeper into cybersecurity topics and prepare for the final exam.
    • Discussed the importance of practical application and real-world scenarios in learning.

b) Video : Part 1 (Debugging and Enhancing GUI Ratings Display + Function to convert Num to *), 

                      Part 2 (Enhancing Python Program: Sorting Ratings, GUI Button Creation, and Dollar Sign Integration) 

                      Part 3 (Python, Proxies, and Practical Cybersecurity: A Detailed Discussion and Implementation)                 

     c) Files: GDrive

     d) Class Code: n/A 

     e) Excercises : N/A

 

15) Class 14 (1 Dec ):

      a) Class Summary: 

  1. Revision on Unit testing and coverage reporting tool
  2. The discussion involved creating a Python function to convert names to a standardized format, using the title method for capitalizing only the initial letter.
  3. A unit test class (TestValidInputs) was implemented to automatically verify the functionality of the function, utilizing the unittest module to assert expected outcomes.
  4. Additionally, a brief introduction to dictionary comprehension in Python was provided, illustrating how to generate a dictionary of book descriptions using a loop within a single line of code.

            

      b) Video : Part 1 (No recording), 

                      Part 2 (Python Function Development, Unit Testing, and Dictionary Comprehension Exploration)        

      c) Files: GDrive

      d) Class Code: n/A 

      e) Excercises : N/A

 

16) Class 15 (5 Dec ):

      a) Class Summary: 

  1. In-Depth Exam Preparation: Gain insights into comprehensive exam preparation for computer science with a seasoned tutor. Explore innovative teaching methods and receive dedicated support in topics like testing, exceptions, and modules. Excel in both theory and practical coding challenges for a holistic understanding.

  2. Mastering Python Concepts: Navigate through complex Python concepts, including polymorphism, exceptions, and advanced topics like generator expressions and yield. Uncover coding tricks and refine your skills with practical exercises, ensuring you're well-prepared for exams that assess both multiple-choice and coding components.

  3. Tricky Python Concepts Decoded: Decode complex Python concepts like yield and generator expressions with a detailed walkthrough. Understand the intricacies of modifying functions for infinite generators and filtering odd numbers. Be prepared for exam scenarios that might challenge your comprehension of advanced Python functionalities.

  4. Dictionary Comprehension in Python:

    • The text introduces dictionary comprehension as a concise way to create dictionaries in Python, emphasizing the use of a compact syntax for transforming lists into key-value pairs.
  5. Generator Expressions:

    • It covers generator expressions, highlighting their similarity to list comprehensions but with a crucial distinction. Generators are discussed as memory-efficient tools for creating iterable sequences, particularly useful for large datasets.
  6. Unit Testing for Python Classes:

    • The text delves into unit testing using the unittest module, focusing on creating test cases for a Python class (Employee), including scenarios like initializing with valid values, handling exceptions for invalid inputs, and verifying the correct calculation of annual salary.

            

      b) Video : Part 1 (Comprehensive Python Exam Preparation and Advanced Coding Concepts Review), 

                      Part 2 (Exam revision Dictionary and Generator Comprehensions, Unit Testing for Classes)        

      c) Files: GDrive

      d) Class Code: n/A 

      e) Excercises : N/A

 

17) Class 16 (7 Dec ):

      a) Class Summary: 

  1. Understanding Priority Queue Operation:

    • The priority queue is organized from the lowest to the highest priority.
    • When calling get on a priority queue, it retrieves the task with the lowest priority first.
  2. Getting the Highest Priority:

    • To obtain the highest priority, you need to keep calling get until the queue is empty.
    • The last retrieved task is the one with the highest priority.
  3. Code Modification for Highest Priority:

    • A modification in the code is needed to ensure the highest priority is obtained.
    • The code should loop through the queue until it's empty, effectively retrieving the highest priority task.
  4. Difference between List and Queue:

    • Lists are used for order or priority, similar to attributes.
    • Queues are suitable for managing waiting lists or processing priorities.
    • Lists maintain values, but queues automatically remove items once retrieved.
  5. Queue Usage Example:

    • Described a restaurant scenario where a queue is used for a waiting list.
    • Highlighted the importance of removing customers once seated, which queues handle automatically.
  6. Unit Testing and Exception Handling:

    • Discussed a Python class for circles, focusing on unit testing and exception handling.
    • Emphasized the importance of checking and raising exceptions for invalid inputs, such as negative values for radius.
  7. Queue vs. List:

    • A queue is used to manage a sequence of items with a specific order, often based on priority or order of arrival. It behaves differently from a list in that once an item is retrieved from a queue, it is automatically removed. This makes it suitable for scenarios where items need to be processed in a specific order and removed once processed.
  8. Unit Testing and Exception Handling:

    • Unit testing involves creating specific tests for individual units or components of code. In the context of class construction, it's important to include tests that ensure valid values are accepted and exceptions are raised for invalid ones. The super keyword is used to call the superclass constructor in an inherited class.
  9. Class Design and Unit Testing Challenge:

    • An exercise involves creating a class for mathematical operations (addition, subtraction, multiplication, and division) and implementing unit tests for each operation. Additionally, a challenging task is to create and test a queue class, ensuring correct functionality for enqueueing and dequeuing items.
  10. Python Queue Class Unit Tests: A User's Journey
  11. Comprehensive Testing: Unraveling the enqueue, size, and isEmpty Methods
  12. Overcoming Assert Statement Challenges: A Glimpse into the Next Session's Plans

      b) Video : Part 1 (Optimizing Priority Queue Operations for Highest Priority Retrieval in Python), 

                       Part 2 (Exploring Class Design, Unit Testing, and Queue Functionality in Python)  

                       Part 3 (Exploring Python Queue Class: In-Depth Unit Testing and Assert Statements)        

      c) Files: N/A

      d) Class Code: n/A 

      e) Excercises : N/A

 

18) Class 17 (8 Dec ):

      a) Class Summary: 

  1. Unit Testing and Code Understanding: The dialogue emphasizes the importance of completing unit testing for a queue implementation in Python. The conversation highlights the need to understand code functionality, identify errors, and ensure proper execution.

  2. Diversified Testing Approaches: The conversation demonstrates the use of different testing approaches, including asserting false for non-empty queues and asserting equal for verifying the size of the queue after insertion and removal operations. This showcases the importance of varied testing scenarios to ensure comprehensive code coverage.

  3. Educational Topics to Cover: The dialogue touches upon other educational topics, such as revisiting the concept of queues, prioritizing unit testing, and exploring exceptions and modules. This reflects the broader context of continuous learning and improvement in programming skills.

  4. Successfully implemented unit tests for the "add" method of the MassOperations class in Python, ensuring accurate addition functionality.
  5. Demonstrated understanding of the assert statement and utilized assertEqual to validate expected results.
  6. Enhanced testing coverage by adding a specific test case for division by zero, employing assertRaises to confirm the correct handling of potential errors.
  7. Introduction to assert raises: The conversation delves into using the assertRaises method in Python for unit testing. It highlights its purpose, syntax, and how it verifies the handling of specific exceptions, such as division by zero and value errors.

  8. Implementation and understanding: The expert guides through the implementation of assertRaises, emphasizing the importance of specifying the exception name as a parameter. A practical example using division by zero and value error is discussed, shedding light on the nuances of writing effective unit tests.

  9. Comparison to assert equal: The text draws a parallel between assertRaises and assertEqual, emphasizing the shared concept of aligning the solution with the problem. This comparison aids in understanding the utility and significance of assertRaises in comprehensive Python unit testing.

      b) Video : Part 1 (Comprehensive Unit Testing and Educational Exploration in Python Programming), 

                      Part 2 (Python Unit Testing: Validating Mass Operations Class with Add and Division by Zero Test Cases)  

                      Part 3 (Mastering Unit Testing in Python: Assert Raises Demystified)        

      c) Files: N/A

      d) Class Code: n/A 

      e) Excercises : N/A

 

* You can run the file on your computer or you can regsiter a free account on https://replit.com to modify the source code, in this case you will need to rename the file as main.py

If you're serious about improving your CS skills then you need to read our tutor testimonials here

 

Our Top 3 Most Read Articles

  Generating leads the easy way  

  GCSE Private Class | Python Tutoring | Computer Science tutor | Middle East  

  IGCSE 0478 computer science Tutor | Flow chart | Learn Python | Pseudo Code Classes | USA  

Add Comment