Introduction to Computers and Python

A simple, book-style explanation of the chapter concepts, examples, tools and modern computing topics

Chapter Overview

Computers & modern computing
Why software, data, cloud and connected devices matter.
Object technology
Classes, objects, methods, attributes, inheritance and reuse.
Python
Why Python is readable, productive and widely used.
Libraries
How existing software saves you from reinventing the wheel.
IPython & Jupyter
Ways to execute Python interactively.
Cloud, IoT & Big Data
How modern applications process huge amounts of connected data.
Waze case study
How many technologies can work together in one application.
Artificial Intelligence
How AI connects computer science, data and learning from data.

Chapter Structure

  1. 1.1 Introduction
  2. 1.2 A Quick Review of Object Technology Basics
  3. 1.3 Python
  4. 1.4 It’s the Libraries!
  5. 1.4.1 Python Standard Library
  6. 1.4.2 Data-Science Libraries
  7. 1.5 Test-Drives: Using IPython and Jupyter Notebooks
  8. 1.5.1 IPython Interactive Mode as a Calculator
  9. 1.5.2 Executing a Python Program Using IPython
  10. 1.5.3 Writing and Executing Code in a Jupyter Notebook
  11. 1.6 The Cloud and the Internet of Things
  12. 1.7 How Big Is Big Data?
  13. 1.7.1 Big Data Analytics
  14. 1.7.2 Data Science and Big Data Use Cases
  15. 1.8 Case Study — A Big-Data Mobile Application
  16. 1.9 Intro to Data Science: Artificial Intelligence
  17. 1.10 Wrap-Up

1.1 Introduction

The chapter starts by placing Python in the larger world of computing. Python is not taught in isolation: later chapters use Python for programming, data science, artificial intelligence, big data and cloud-based applications.

Beginner idea: Think of this chapter as a map. It does not teach all Python syntax yet. It shows you what Python is, what tools you will use, and where your Python skills can take you.

Why is this chapter important?

Before learning many commands, it helps to understand the ecosystem: Python → libraries → tools → data → applications → AI/big data.

PythonLibrariesToolsDataApplications
Remember: Chapter 1 builds the foundation for the programming and data-science chapters that follow.

1.2 A Quick Review of Object Technology Basics

Python is object-oriented, so the chapter first explains the basic vocabulary of object technology.

1. What is an object?

An object is a software entity that combines information with operations that can work on that information.

Use the car analogy:

  • Attributes describe the car: color, speed, fuel, number of doors.
  • Behaviors describe what the car can do: accelerate, brake, steer.

Why needed? Objects let us model real-world ideas in software and keep related data and behavior together.

2. What is a method?

A method is a function associated with an object/class that performs a task.

message = "hello"
print(message.upper())
HELLO

How it works: message refers to a string object. upper() is a method of that string object. Calling it asks the object to perform the operation.

Real-world use: A bank-account object might have methods such as deposit and withdraw.

3. What is a class?

A class is a definition/blueprint used to create objects. It describes the data and behavior that objects of that class can have.

Easy analogy: Class = blueprint. Object = actual thing built from the blueprint.

4. What is instantiation?

Instantiation means creating an object from a class. The resulting object is an instance of that class.

class Student:
    pass

student1 = Student()

Here, Student is the class and student1 is an instance.

5. Reuse

One major benefit of classes is reuse. A class can be used to create many objects instead of writing the same design repeatedly.

student1 = Student()
student2 = Student()
student3 = Student()

All three objects come from the same class definition.

6. Messages and method calls

In object-oriented terminology, asking an object to perform an operation can be described as sending a message. In Python, this is commonly seen as a method call.

message = "python"
message.upper()

The call message.upper() asks the string object to perform its upper operation.

7. Attributes and instance variables

An attribute is information associated with an object. Instance variables are commonly used to store object-specific data.

class Student:
    def __init__(self, name):
        self.name = name

s1 = Student("Aman")
s2 = Student("Priya")

print(s1.name)
print(s2.name)
Aman Priya

Each object carries its own name value.

8. Inheritance

Inheritance lets a new class start with characteristics of an existing class and then customize or extend them.

class Vehicle:
    def move(self):
        print("Moving")

class Car(Vehicle):
    pass

car = Car()
car.move()
Moving

Vehicle is the superclass/base class. Car is the subclass. The subclass gets the inherited behavior.

9. Object-Oriented Analysis and Design (OOAD)

For a large software system, you should not simply start typing code. First understand requirements (what the system must do), then create a design (how it should do it). When this is done from an object-oriented viewpoint, it is called Object-Oriented Analysis and Design (OOAD).

Remember: Class → blueprint; object → instance; method → behavior/task; attribute → data; inheritance → reuse and extension of an existing class.
Common mistake: Do not think that a class and an object are exactly the same thing. A class describes a kind of object; an object is a particular instance created from that class.

1.3 Python

Python was released publicly in 1991 and was developed by Guido van Rossum. The chapter describes Python as an object-oriented scripting language and explains why it became widely used.

Why is Python popular?

  • Open source and free: Python and a large ecosystem are freely available.
  • Easy to learn: Its syntax is relatively approachable for beginners.
  • Readable: Python code is designed to be concise and readable.
  • Large library ecosystem: Existing libraries let developers accomplish complex tasks with less code.
  • Web development: Python is used with frameworks such as Django and Flask.
  • Multiple programming paradigms: procedural, functional-style and object-oriented programming are supported.
  • Concurrency: Python provides facilities such as asyncio and async/await.
  • Wide application range: Python can be used for scripts, applications, data science and AI.
  • Data science and AI: Python has a strong ecosystem for these fields.
  • Large community and job market: Many developers and organizations use Python.

Anaconda Python Distribution

The book uses the Anaconda Python distribution. It packages Python with many tools and libraries commonly needed for programming and data science, including IPython and Jupyter.

Beginner idea: Anaconda is a convenient Python environment containing Python plus many useful packages and development tools.

The Zen of Python

Python also has a collection of design principles known as The Zen of Python, associated with Tim Peters and PEP 20.

import this

In an interactive Python environment, this displays the Zen of Python.

Remember: The Zen of Python is about principles such as readability, simplicity and clarity in Python programming.

1.4 It’s the Libraries!

One of the chapter's central messages is: do not reinvent the wheel when a good library already solves the problem.

A library contains reusable software that your program can use.

Why are libraries needed?

  • Save development time.
  • Reduce the amount of code you need to write.
  • Provide tested and reusable functionality.
  • Allow programmers to work on higher-level problems instead of low-level implementation details.

Simple example

import math

print(math.sqrt(25))
5.0

Instead of implementing square-root mathematics yourself, you use the existing sqrt function from the math module.

Real-world use: Data analysis, machine learning, file processing, networking and visualization all depend heavily on libraries.

1.4.1 Python Standard Library

The Python Standard Library is the collection of modules supplied with Python. It covers many common programming tasks.

ModuleBeginner-friendly meaning
collectionsAdditional useful data structures.
csvWork with comma-separated-value files.
datetime, timeWork with dates and times.
decimalDecimal arithmetic, including money-related calculations.
doctestSimple testing using examples/results.
jsonProcess JSON data used commonly in web applications.
mathMathematical constants and operations.
osInteract with the operating system.
queueQueue data structures.
randomPseudorandom values.
reRegular-expression pattern matching.
sqlite3SQLite database access.
statisticsStatistics such as mean, median and mode.
stringString-related utilities.
sysSystem and command-line related functionality.
timeitPerformance measurement.

1.4.2 Data-Science Libraries

Python's open-source community has created libraries for scientific computing, data manipulation, visualization, machine learning, deep learning and natural-language processing.

LibraryWhat it is used for
NumPyHigh-performance arrays and numerical processing.
SciPyScientific computing built on NumPy.
StatsModelsStatistical models, tests and exploration.
PandasData manipulation; Series and DataFrames.
MatplotlibCharts and visualizations.
SeabornHigher-level statistical visualization built on Matplotlib.
scikit-learnMachine learning.
KerasHigh-level deep-learning development.
TensorFlowLarge-scale numerical/deep-learning computation and acceleration.
OpenAI GymDeveloping/testing reinforcement-learning algorithms.
NLTKNatural language processing.
TextBlobSimplified object-oriented NLP processing.
GensimDocument indexing and similarity-related NLP tasks.
Remember: You do not need to memorize every library now. Understand the idea: Python's ecosystem provides specialized tools for specialized jobs.

1.5 Test-Drives: Using IPython and Jupyter Notebooks

The chapter now moves from concepts to actually running Python.

Three ways are introduced:

Interactive mode
Enter a small snippet and immediately see the result.
Script mode
Run Python code saved in a .py file.
Jupyter Notebook
Run code in cells and combine code with explanatory content.

1.5.1 Using IPython Interactive Mode as a Calculator

IPython is an enhanced interactive Python interpreter. You type Python instructions and get immediate feedback.

Start IPython

ipython

After starting, you see an input prompt similar to In [1]:.

Evaluate an expression

45 + 72
117

Python reads the expression, evaluates it and displays the result.

Arithmetic expression

5 * (12.7 - 4) / 2
21.75

How does Python calculate it?

  1. (12.7 - 4) is evaluated first → 8.7.
  2. 5 * 8.743.5.
  3. 43.5 / 221.75.
SymbolMeaning
+Addition
-Subtraction
*Multiplication
/Division
()Parentheses can force part of an expression to be evaluated first.

Integers vs floating-point numbers

  • Integer: whole number such as 5.
  • Floating-point number: number containing a decimal part such as 12.7.
Common mistake: Do not confuse * with exponentiation. In Python, multiplication is *; exponentiation uses **.

Exit IPython

exit

You can also use the platform's appropriate keyboard shortcut as described by the book.

1.5.2 Executing a Python Program Using the IPython Interpreter

A Python source file normally uses the .py extension. Such a file can contain a complete program, often called a script.

Running a script

The chapter demonstrates running the supplied dynamic die-rolling program:

ipython RollDieDynamic.py 6000 1

The two numbers are command-line arguments used by the example: the first controls the number of updates/rolls in the demonstration and the second controls how many dice are rolled at a time.

Law of Large Numbers

A fair six-sided die has six possible results. Each face has probability 1/6, approximately 16.667%. A small number of rolls can vary considerably. As the number of rolls becomes very large, observed percentages tend to get closer to the expected probability.

Remember: Random does not mean “perfectly equal every time.” With more trials, the observed proportions tend to move closer to the expected probabilities.

Creating scripts

The normal workflow is:

WriteSave as .pyRunObserveFixRun again

Runtime errors

Some errors happen while a program is running. These are runtime errors or execution-time errors.

10 / 0

This attempts an illegal division by zero and raises a runtime error.

Common mistake: A program can be syntactically valid and still fail while running. “The code looks correct” does not guarantee that every operation is valid.

IDE

An Integrated Development Environment (IDE) provides tools such as editing and debugging. The chapter mentions examples including Spyder, PyCharm and Visual Studio Code.

1.5.3 Writing and Executing Code in a Jupyter Notebook

A Jupyter Notebook is an interactive, browser-based environment where you can combine executable code with explanatory material and other media.

Why is Jupyter useful?

  • Run code in small pieces.
  • See output directly below code.
  • Mix code and explanations.
  • Useful for data analysis and experiments.
  • Easy to share a computational narrative.

Start JupyterLab

jupyter lab

This starts the Jupyter server and opens JupyterLab in a browser.

Create a notebook

Create a Python notebook from the Launcher. The notebook file uses the .ipynb extension.

Cells

The basic working unit is a cell. A cell can contain Python code that you execute independently.

45 + 72
117
5 * (12.7 - 4) / 2
21.75

Important notebook actions

ActionPurpose
Ctrl + EnterExecute the current cell.
Shift + EnterExecute the current cell and move to/add the next cell.
Save NotebookSave your notebook changes.
Run All CellsExecute cells in order.
Restart Kernel / Clear OutputsReset execution state and remove displayed outputs.
Kernel in simple words: The kernel is the process that actually executes your Python code for the notebook.
Remember: IPython gives interactive Python execution. Jupyter Notebook provides a convenient document-like environment around an IPython kernel.

1.6 The Cloud and the Internet of Things

1.6.1 The Cloud

Cloud computing means computing resources and services are provided through networked systems, commonly over the Internet. Applications can use remote computing, storage, databases and web services rather than doing everything locally.

Web service

A web service provides access to functionality/data over the Internet. A Python library can hide much of the network communication from you.

Your Python AppPython Library/ObjectWeb ServiceCloud Resources

Real-world examples discussed by the chapter: social-media services, translation, speech services, cloud computing platforms, dashboards and streaming services.

Mashups

A mashup combines complementary services or information feeds to build a new application quickly.

Example idea: combine a mapping service with another source of location information to create an application that displays useful information on a map.

1.6.2 Internet of Things (IoT)

The Internet of Things connects physical things that can communicate data over the Internet. A “thing” can have an IP address and can send, and sometimes receive, data automatically.

Smart thermostat → sends temperature information.
Smart meter → reports energy usage.
Vehicle sensor → supplies location/status information.
Warehouse tracker → reports item location.
Remember: IoT is not just “the Internet on a computer.” It is about physical objects/devices participating in networked data exchange.

1.7 How Big Is Big Data?

The chapter explains that modern computing creates enormous quantities of digital data. Data now comes from websites, phones, cameras, sensors, applications, transactions and many other sources.

Understanding storage units

UnitSimple idea
MBMegabyte — around a million bytes in everyday approximation.
GBGigabyte — roughly a thousand MB.
TBTerabyte — roughly a thousand GB.
PBPetabyte — roughly a thousand TB.
EBExabyte — roughly a thousand PB.
ZBZettabyte — roughly a thousand EB.
Why this matters to a Python programmer: When datasets become very large, ordinary single-machine processing may not be enough. This leads to specialized data structures, databases, distributed processing and cloud infrastructure.

Computing power

Large datasets also require substantial computing power. The chapter uses FLOPS—floating-point operations per second—as a measure of computational performance.

Distributed computing

Instead of using one computer for everything, a task can be distributed across many computers. This can provide much more processing capacity for very large workloads.

Energy considerations

The chapter also points out that processing and storing huge quantities of data requires significant electricity. Modern computing therefore has both performance and energy considerations.

1.7.1 Big Data Analytics

Data analytics means examining data to discover useful information and insights. Big data analytics applies these ideas to very large, fast-moving and varied datasets.

The four V's introduced in the chapter

VMeaningEasy example
VolumeHow much data exists.Millions of app events.
VelocityHow quickly data is produced, moved or changes.Live sensor readings.
VarietyDifferent forms of data.Text, images, audio, video and sensor data.
VeracityHow trustworthy, accurate and complete the data is.Checking whether sensor data is reliable.
Memory trick: Volume = amount, Velocity = speed, Variety = types, Veracity = trustworthiness.

Why analytics matters

The purpose is not simply to collect numbers. The goal is to turn data into insight that can support decisions.

1.7.2 Data Science and Big Data Are Making a Difference: Use Cases

The chapter lists many areas where data science and big data can be applied. The important beginner lesson is that data science is not limited to one industry.

Healthcare
Diagnosis, outcome prediction, personalized medicine.
Finance
Risk analysis, fraud detection, automated investing.
Transportation
Dynamic routes, ride sharing, traffic systems.
Marketing
Customer analysis, recommendations and personalization.
Security
Threat, spam and anomaly detection.
Environment
Weather, pollution and crop-related analysis.
Sports
Recruiting, coaching and performance analysis.
Language
Translation, sentiment analysis and text processing.
Big picture: Data science becomes valuable when data is used to answer a useful question, improve a decision or automate a task.

1.8 Case Study — A Big-Data Mobile Application

Waze as a big-data example

The chapter uses the Waze navigation application to show how many technologies can work together in a modern system.

Static navigation vs dynamic navigation

Older navigation systems could rely heavily on maps and GPS coordinates. A modern system can continuously receive information and change the route according to current conditions.

Crowdsourced data

Crowdsourced data is information supplied by many users/devices. Waze can receive location updates and user reports about road conditions, incidents and other information.

Technology pipeline

Phones/GPSInternetCloud serversBig-data processingAnalysis/AIUpdated route

Technologies connected in the case study

TechnologyRole in the example
Open-source softwareReusable software components can help build applications.
JSONCan represent data exchanged between applications/services.
Speech synthesisConverts information into spoken directions.
Speech recognitionConverts spoken commands into data/text.
NLPHelps interpret natural-language commands.
VisualizationDisplays maps, alerts and changing information.
IoTPhones can act as connected sensors.
Cloud + parallel processingHelps process huge streams from many devices.
AI / machine learningCan use data to predict or choose useful routes.
Graph databasesCan represent networks and support route-related calculations.
Computer visionCould analyze images from cameras to detect objects/conditions.
Remember: The case study is valuable because it shows that a real application is usually not “just Python.” It can combine programming, data, networks, databases, cloud computing, visualization and AI.

1.9 Intro to Data Science: Artificial Intelligence — at the Intersection of CS and Data Science

The chapter introduces Artificial Intelligence (AI) as an area where computer science and data science meet. Modern AI systems can learn useful patterns from data and use those patterns to perform tasks that appear intelligent.

What kinds of problems can AI address?

  • Game playing
  • Computer vision
  • Self-driving systems
  • Robotics
  • Medical analysis
  • Speech recognition and translation
  • Chatbots and language applications

Important AI milestones discussed

Deep Blue — The chapter discusses the 1997 chess match in which IBM's Deep Blue defeated reigning world chess champion Garry Kasparov under tournament conditions.
Watson — IBM Watson defeated top human Jeopardy! players in 2011, demonstrating large-scale language analysis and information retrieval.
AlphaGo — DeepMind's system used deep learning to defeat a strong Go player.
AlphaZero — The chapter describes a system that learned games using reinforcement learning rather than simply being supplied with a fixed list of moves.

Machine learning vs traditional programming

A simple way to understand the chapter's idea:

Traditional approach
Programmer writes explicit rules → computer follows rules → result.
Machine learning approach
Provide data/examples → learning algorithm finds patterns → model produces predictions/actions.
Important: The chapter is introducing AI conceptually. Detailed machine-learning and deep-learning implementation comes later in the book.

A lesson from the sequence-prediction story

The chapter tells a story about trying to predict number sequences. A sequence such as 14, 23, 34, 42 can have an answer that depends on outside knowledge rather than a simple mathematical pattern. The lesson is important: intelligent behavior may require broader knowledge and context, not just arithmetic.

AI and Big Data

Modern AI often benefits from large amounts of data. Machine learning and deep learning can learn patterns from data rather than requiring programmers to manually write every possible rule.

Remember: In this chapter, AI is introduced as a field connected strongly to data. Later chapters go deeper into machine learning, deep learning and AI applications.

1.10 Wrap-Up

This chapter establishes the vocabulary and big picture needed for the rest of the book.

Quick Revision

ConceptOne-line meaning
ObjectA software entity containing data and behavior.
ClassA definition/blueprint for creating objects.
InstantiationCreating an object from a class.
InstanceAn object created from a class.
MethodAn operation/behavior associated with an object or class.
AttributeData associated with an object.
InheritanceA subclass receives characteristics from a superclass.
LibraryReusable software that provides functionality.
IPythonAn enhanced interactive Python interpreter.
ScriptPython source code saved in a .py file.
Jupyter NotebookAn interactive environment using executable cells plus explanatory content.
CloudNetwork-accessible computing resources and services.
IoTConnected physical devices that exchange data.
Big DataVery large, fast-moving and varied data requiring appropriate infrastructure and analysis.
VolumeAmount of data.
VelocitySpeed of data generation/movement/change.
VarietyDifferent types/forms of data.
VeracityData reliability/trustworthiness.
AIComputer systems performing tasks associated with intelligent behavior, often using data-driven learning.

Key Points

  • Python is designed for readability and productivity and has a large ecosystem.
  • Object-oriented terminology helps you understand Python's design.
  • Libraries allow you to reuse existing functionality.
  • The Standard Library handles many common programming tasks.
  • Data-science libraries specialize in numerical work, data handling, visualization, ML, deep learning and NLP.
  • IPython supports immediate interactive experimentation.
  • Python scripts are saved in .py files.
  • Jupyter uses cells to execute code interactively in a browser-based environment.
  • Cloud services provide computing and application functionality over networks.
  • IoT connects physical devices that can send/receive data.
  • Big Data is characterized in this chapter using Volume, Velocity, Variety and Veracity.
  • Modern applications can combine cloud, IoT, databases, analytics, visualization and AI.
  • AI and data science are strongly connected because many modern AI systems learn from data.

Important Python Syntax from This Chapter

# Start an interactive Python environment
ipython

# Arithmetic
45 + 72
5 * (12.7 - 4) / 2

# Import a module
import math

# Use a library function
math.sqrt(25)

# Define a very simple class
class Student:
    pass

# Create an instance
student = Student()

# Method call
text = "python"
text.upper()

# Start JupyterLab
jupyter lab

# A Python script is normally saved like:
my_program.py

Interview / Exam Questions

1. What is Python?
Show answer

Python is a high-level programming language described in the chapter as an object-oriented scripting language. It is widely used because of its readability, productivity and extensive library ecosystem.

2. What is the difference between a class and an object?
Show answer

A class defines the structure/behavior; an object is an instance created from that class.

3. What is instantiation?
Show answer

Instantiation is the process of creating an object from a class.

4. What is inheritance?
Show answer

Inheritance lets a subclass start with characteristics of an existing superclass and then customize or extend them.

5. Why are libraries important?
Show answer

They provide reusable functionality so developers can perform substantial tasks without implementing everything from scratch.

6. What is the Python Standard Library?
Show answer

It is the collection of modules supplied with Python for many common tasks such as mathematics, files, dates, JSON, statistics and operating-system interaction.

7. What is IPython?
Show answer

An enhanced interactive Python interpreter that gives immediate feedback when Python code is entered.

8. What is a Python script?
Show answer

A file containing Python source code, normally using the .py extension.

9. What is a Jupyter Notebook?
Show answer

An interactive, browser-based environment where code can be executed in cells alongside explanatory content and other media.

10. What are the four V's of Big Data?
Show answer

Volume, Velocity, Variety and Veracity.

11. What is IoT?
Show answer

The Internet of Things connects physical objects/devices that can exchange data over the Internet.

12. Why is AI connected with data science?
Show answer

Many modern AI approaches, especially machine learning and deep learning, learn patterns from data and use those patterns to make predictions or perform tasks.

Practice Questions

  1. Start IPython and calculate 25 + 17.
  2. Evaluate 8 * (10 - 3) / 2 and explain the order of evaluation.
  3. Use math.sqrt() to calculate the square root of 144.
  4. Create a simple Student class and create two objects from it.
  5. Explain class, object, method and attribute using a real-world example.
  6. Create a parent Vehicle class and a child Car class to demonstrate inheritance.
  7. Write the four V's of Big Data and give one example for each.
  8. Explain the difference between IPython interactive mode and a Python script.
  9. Explain why Jupyter Notebook is useful for data science.
  10. Draw a simple architecture showing how a phone can act as an IoT device and send data to a cloud application.
  11. Choose a real application and identify where it might use a library, cloud service, database, visualization and AI.

🧠 Final Memory Map

PythonObjects & ClassesLibrariesIPython/JupyterCloud & IoTBig DataData ScienceAI

If you remember only one idea from Chapter 1: Python is the programming foundation, but its real power comes from combining Python with reusable libraries, interactive tools and modern data/AI technologies.