Docsity

Python Programming: Understanding Algorithms & Writing Simple Programs with Jupyter, Lecture notes of Mathematics

Partial preview of the text

Download Python Programming: Understanding Algorithms & Writing Simple Programs with Jupyter and more Lecture notes Mathematics in PDF only on Docsity!

PYTHON

Coding Studio

GU Women Coders

LECTURE OVERVIEW

§ What is an algorithm? How do we write them? § Python – Jupyter Notebooks § Simple programs § Basic Conditionals § Magic 8 Ball

PROBLEM SOLVING Software Development Imagine Design Create (implement) Test Experiment Evaluate (reflect) The Life Cycle

Problem Solving

1. Identify the problem (idea)

2. Understand the problem

3. Identify alternative ways to solve the problem

4. Select the best solution

5. List the instructions or steps for the best

solution (write the algorithm)

6. Evaluate the solution

What are the steps?

Python § Python is a programming language that allows you to communicate with the computer using a higher level language than using 0s and 1s. § A Python program is a text file that can be edited in a text editor (nano, vi, emacs) or IDLE. § There are 2 production versions, 3.4.0 and 2.7. § We will use Jupyter Notebooks § Jupyter Notebooks is an interactive computational environment, that lets you combine code execution, rich text, mathematics, plots and other media. § To allow for easy collaboration during lectures, we will use Google’s Jupyter Notebooks cloud environment.

Go To Your Notebook

  • https://colab.research.google.com/notebooks/welcome.ipynb#

https://colab.research.google.com/notebooks/welcome.ipynb#

STATEMENT Statement A statement executes a single action.

Addition Task

Write a program that adds two numbers together:

Translate to Python 3 + 5 START END Add 3 and 5

A variable is a place to store information like

numbers, text (strings), lists of numbers, etc.

A variable is just a label for a piece of information.

lisa = 10

lisaAge = 21

lisaDepartment = “Computer Science”

Variables

What are they?

INPUT OUTPUT Input/ Output

Print the result

Write a program that prints the result of adding 3 and 5.

Translate to Python START: We have 2 numbers Print result END Add the two numbers result = 3 + 5 print(result)

SEQUENCE Statement Statement Statement

... A statement executes a single action. A sequence is a series of statements that execute one after another.