You are on page 1of 25

v

Microsoft Imagine Academy

Introduction to Python
Unit 1 Module 1
Introduction to Python

Unit 1 Module 1

Table of Contents
Module 1 Outline.............................................................................................................................3
1.1: Getting Started with Python in Jupyter Notebooks..................................................................5
1.2: Types and Variables.................................................................................................................6
1.3: Type() Function........................................................................................................................7
1.4: Addition and Errors..................................................................................................................8
1.5: ASCII Art.................................................................................................................................9
1.6: Input........................................................................................................................................10
1.7: Print Formatting......................................................................................................................11
1.8: Quote Display and Boolean....................................................................................................12
1.9: String Formatting and the 'in' Keyword..................................................................................13
Module 1 Labs...............................................................................................................................14
Module 1 Project............................................................................................................................14

2
Introduction to Python

Unit 1 Module 1

Module 1 Outline
Section Title Topics
#

1.1 Getting Started with Python in Jupyter 1.1.1 Using Jupyter Notebooks
Notebooks 1.1.2 Hello World!
1.1.3 Comments
1.1.4 Notebooks and Libraries
1.1.5 Altering Notebook Structure
Quiz 1.1

1.2 Types and Variables 1.2.1 What is a String?


1.2.2 Integers
1.2.3 Variables
1.2.4 Data Types
Quiz 1.2

1.3 Type() Function 1.3.1 Using type()


Quiz 1.3

1.4 Addition and Errors 1.4.1 Addition: Number and String


1.4.2 Variable Addition
1.4.3 Errors!
1.4.4 More Errors!
Quiz 1.4

1.5 ASCII Art 1.5.1 ASCII Art

1.6 Input 1.6.1 User Input


1.6.2 Input Prompts
Quiz 1.6

1.7 Print Formatting 1.7.1 Comma-separated String Printing


1.7.2 Printing Numbers with Strings

3
Introduction to Python

Unit 1 Module 1

Using Commas
Quiz 1.7

1.8 Quote Display and Boolean 1.8.1 Quotes in Strings


1.8.2 Boolean String Tests
Quiz 1.8

1.9 String Formatting and the 'in' keyword 1.9.1 String Format Methods
1.9.2 Input Formatting
1.9.3 Boolean 'in' Keyword
Quiz 1.9

Lab 1a Basics Practice: Notebooks, Comments,  


print(), type(), Addition, Errors, and Art

Lab 1b Strings Practice: Input, Testing, and  


Formatting

Project Module 1 Coding Assignment  

4
Introduction to Python

Unit 1 Module 1

5
Introduction to Python

Unit 1 Module 1

1.1: Getting Started with Python in Jupyter Notebooks


 

Objectives00

You will be able to:


 Understand the history of programming languages.
 Understand the differences between high-level and low-level languages.
 Understand how to work with Jupiter notebooks.
 Write basic working code using the Python 3 programming language.

Notebook-led content
Open the Unit1_Mod1_1.1 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.1.1 Using Jupiter  _print


Notebooks

1.1.2 Hello World!  print (“hello world”)

1.1.3 Comments  #

1.1.4 Notebooks and  


Libraries

1.1.5 Altering Notebook  


Structure

6
Introduction to Python

Unit 1 Module 1

Section question
“Why is programming so important to our information driven age?”

7
Introduction to Python

Unit 1 Module 1

1.2: Types and Variables


 

Objectives

You will be able to:


 Understand how variables work in Python.

 Understand a data type.


 Understand the type() built-in function.

Notebook-led content
Open the Unit1_Mod1_1.2 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.2.1 What is a  the characters which are enclosed in single or double quotes
String?

1.2.2 Integers The numbers

1.2.3 Variables Which stores the data 

8
Introduction to Python

Unit 1 Module 1

1.2.4 Data Types  the datatype tells the interpreter what type of the data to be
expected

Section questions
 3 things you learned from the lesson
 2 things you found most interesting
 1 question you still have

9
Introduction to Python

Unit 1 Module 1

1.3: Type () Function


 

Objectives

You will be able to:


 Write working code using type () and variables
 Str=43
 Print(type(str))

Notebook-led content
Open the Unit1_Mod1_1.3 Practice File and complete the following sections. Take notes as needed.

Section Notes
Topic

1.3.1 Using  we get the data type of the variable


type()

10
Introduction to Python

Unit 1 Module 1

11
Introduction to Python

Unit 1 Module 1

1.4: Addition and Errors


 

Objectives

You will be able to:


 Understand string/number addition and add variables.
 Understand the three main types of errors.
 Understand how to fix each type of error.

Notebook-led content
Open the Unit1_Mod1_1.4 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.4.1 Addition: Numbers and  


Strings

1.4.2 Variable Addition  

1.4.3 Errors!  

1.4.4 More Errors!  

 
12
Introduction to Python

Unit 1 Module 1

Section questions
 What kinds of errors can programs have?
 Have you identified a bug or error in a program or game that you use?

13
Introduction to Python

Unit 1 Module 1

1.5: ASCII Art


 

Objectives

You will be able to:


 Create on-screen art.

Notebook-led content
Open the Unit1_Mod1_1.5 Practice File and complete the following sections. Take notes as needed.

Section Notes
Topics

1.5.1 ASCII Art  

Section questions
Write a paragraph (4-5 sentences) on how you feel about programming based on the sections 1.1-1.5 of this
unit.

14
Introduction to Python

Unit 1 Module 1

15
Introduction to Python

Unit 1 Module 1

1.6: Input
 

Objectives

You will be able to:


 Understand the input() function.
 Apply the input() and print() function in programs.

Notebook-led content
Open the Unit1_Mod1_1.6 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.6.1 User Inputs  

1.6.2 Input Prompts  

 
16
Introduction to Python

Unit 1 Module 1

17
Introduction to Python

Unit 1 Module 1

1.7: Print Formatting


 

Objectives

You will be able to:


 Apply formatting to the print() function

Notebook-led content
Open the Unit1_Mod1_1.7 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.7.1 Comma-separated String Printing

1.7.2 Printing Numbers with Strings Using  


Commas

 
18
Introduction to Python

Unit 1 Module 1

Class activity
Create a simple quiz on string formatting and then have a partner take the quiz.

19
Introduction to Python

Unit 1 Module 1

1.8: Quote Display and Boolean


 

Objectives

You will be able to:


 Understand what a Boolean value is.
 Understand string methods and how to use them.

Notebook-led content
Open the Unit1_Mod1_1.8 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.8.1 Quotes in Strings  

1.8.2 Boolean String  


Tests

20
Introduction to Python

Unit 1 Module 1

21
Introduction to Python

Unit 1 Module 1

1.9: String Formatting and the 'in' Keyword


 

Objectives

You will be able to:


 Apply string formatting methods.
 Understand the in keyword.

Notebook-led content
Open the Unit1_Mod1_1.9 Practice File and complete the following sections. Take notes as needed.

Section Topics Notes

1.9.1 String Format  


Method

1.9.2 Input Formatting  

1.9.3 Boolean 'in'  


Keyword

22
Introduction to Python

Unit 1 Module 1

Class activity
Create a simple quiz on string formatting and then have a partner take the quiz.

23
Introduction to Python

Unit 1 Module 1

Module 1 Labs
 

Lab 1a: Basics Practice: Notebooks, Comments, print(), type(), Addition,


Errors and Art

In this lab, you will practice the skills taught in sections 1.1 through 1.5 of Module 1, specifically:
 Use Python 3 in Jupyter notebooks.
 Write working code using print() and # comments.
 Write working code using type() and variables.
 Combine strings using string addition (+).
 Add numbers in code (+).
 Troubleshoot errors.
 Create character art.

Lab Instructions
1. Open the Unit1_Mod01_Practice1a file from the cloned notebook library.

2. Follow the instructions to complete the tasks as directed in the practice file.

3. Save and close the practice file.

Lab 1b: Strings Practice: Input, Testing, and Formatting

In this lab, you will practice the skills taught in sections 1.6 through 1.9 of Module 1, specifically:
 Gather, store, and use string input.
 Format print() output.
 Test string characteristics.

24
Introduction to Python

Unit 1 Module 1

 Format string output.


 Search for a string in a string.

Lab Instructions
1. Open the Unit1_Mod01_Practice1b file from the cloned notebook library.

2. Follow the instructions to complete the tasks as directed in the practice file.

3. Save and close the practice file.

Module 1 Project
 

Program: Allergy Check


This program requires the use of print output and code syntax covered in Module 1.

Instructions
1. Open the Unit1_Mod01_Project1 file from the cloned notebook library.

2. Read the program information and requirements.

3. Create the program.

4. Save and close the practice file.

25

You might also like