# Course Introduction

### What is Computer Science?

Computer science is broadly the study of algorithms.

An algorithm is a detailed, step-by-step set of instructions for solving some problem, or accomplishing some task.

Algorithms predate computers by thousands of years. The earliest algorithms were created by mathematicians to solve math problems. For example early algorithms were created to multiply, factorize, and find square roots.

One key aspect of an algorithm is that you can follow it to find the correct answer without understanding why it works. Algorithms can be carried out by people to solve problems, without them having to really understand the problem and solve it from scratch each time.

With the development of computers, we can now set them to execute our algorithms instead. Computers don't really understand what they are doing, they just follow the algorithms that computer scientists develop for them.

Algorithm design is solving problems by creating algorithms.

Algorithm analysis is studying how well an algorithm works, such as how many steps it takes to execute it.

Computer programming is translating an algorithm into a language that the computer can understand.

### Example: Guess the Number

In the "Guess the Number" game, player A thinks of a number, and player B must guess it. There are two variations of this game that we can consider, based off what player A tells player B when they guess wrong:

1. Just "no".
2. Whether the number is too high or too low.

What algorithms can we come up with for solving variant 1? How about variant 2?

### Python

Python is a popular high-level programming language. It is designed to be simple straightforward to get started with. Despite being simple, it is widely used in the computer industry including:

• Dropbox
• Pinterest
• Reddit
• Instagram
• Yelp
• BitTorrent
• Blender
• ArcGIS
• Civilization IV
• Sims 4

### Python Programs

Python programs are text files which end with the .py extension. They can be created with any text editor (not word processor). In this class, we will use "IDLE" which comes with Python.

The simplest program is the "Hello World" program which simply prints out the message "Hello World" and then quits. The program is given here:


# program to print hello world

print("Hello World")