Python Programming: Examples and Tips for INFO2000 Midterm

General Python Tips:

  • Loops: Use for i in range(start, stop, step): for iteration.
  • Lists: my_list = [1, 2, 3], access elements with my_list[index].
  • Dictionaries: my_dict = {'key': 'value'}, access with my_dict['key'].
  • Functions: Use def function_name(parameters): return value to define.
  • Importing Libraries: Use import random, import math.
  • Printing Debugging Info: Use print(variable).
  • String Manipulation: .upper(), .lower(), .strip(), .split(), .join().
  • File Handling: open('filename.txt', 'r') to read, open(
Read More

Understanding Computer Hardware and Software Components

Understanding Computer Hardware and Software

Data is the set of scientific and technical knowledge that enables the automatic processing of information. The term comes from the union of two words, referring to computers and their components:

Hardware and Software

A computer is composed of two separate, but closely related, parts:

  • Hardware: Consists of the physical elements of the computer. It’s essentially made of electronic components that provide the necessary support for the interpretation and execution
Read More

Network Database Model: Structure and DBTG CODASYL

Network Model

In the relational model, data and data relationships are presented with a series of tables. The network model is different; data is expressed through a series of records, and data relationships through links. A network database consists of a series of records that are interconnected through links.

A record is similar to an entity in the entity-relationship model. Every record is a set of fields (attributes), each of these contains only one data value. A link is an association between

Read More

Operating System: Functions and Features

Operating System

An Operating System (OS) is a program or set of computer programs designed to ensure effective management of a computer’s resources. It starts working when the computer is turned on and manages the hardware of the machine from the most basic levels, allowing interaction with the user. An operating system can normally be found in most electronic devices that use microprocessors, such as cell phones, DVD players, car stereos, and PCs. These devices use the OS to understand the machine

Read More

Networking Fundamentals: Switches, Routing, DNS, and Security

How Switches Work: Learning, Flooding, Filtering, Forwarding, and Aging

Switches operate similarly to hubs, but with the added capability of identifying the intended destination of received information. This allows them to send data only to the computers that are supposed to receive it. The key functions are:

  • Learning: The switch reads the MAC address and saves it to a lookup table. This allows the switch to know where to find the node (Source MAC, segment, port, timestamp).
  • Flooding: The switch
Read More

2D and 3D Graphics: Transformations, Shaders, and Game Engines

Explain in detail the different 2D transformations


2D transformations modify an object’s position, size, orientation, or shape. They are essential in graphics for scaling images, rotating objects, translating shapes, and shearing figures.

Basic Transformations:

  1. Translation: Moves an object without altering its shape.

  2. Scaling: Enlarges or shrinks an object based on factors Sx,SyS_x, S_y.

  3. Rotation: Rotates an object about a fixed point by angle θ\theta.

  4. Shearing: Distorts an object along the x or y-axis.

Read More