0% found this document useful (0 votes)
4 views9 pages

Intro to Python Programming Basics

This document outlines a lesson on Python programming, focusing on extending and modifying a simple program. It includes steps for completing code, running the program, and interacting with user input. The lesson emphasizes understanding program output and error handling.

Uploaded by

kaizaemmanuel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Intro to Python Programming Basics

This document outlines a lesson on Python programming, focusing on extending and modifying a simple program. It includes steps for completing code, running the program, and interacting with user input. The lesson emphasizes understanding program output and error handling.

Uploaded by

kaizaemmanuel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computing

Lesson 1: First steps

Introduction to Python programming

Rebecca Franks

Materials from the Teach Computing Curriculum created by the National Centre for Computing Education
Step 1: Extend the program

Extend the existing program from the 1 user = "Claude"


previous task by typing in two similar 2 print("Hello", user)
3 lucky = 13
additional statements. Note that line 4
4 print( )
is incomplete.

2
Step 2: Complete line 4

Complete line 4, so that the output of 1 user = "Claude"


the program is: 2 print("Hello", user)
3 lucky = 13
Hello Claude 4 print( )

My lucky number is 13

Make sure that your program displays


the value of the lucky variable, not just
the number 13.

3
Step 3: Run your program

Did it work? 1 user = "Claude"


2 print("Hello", user)
Did you get any error messages? 3 lucky = 13
4 print( )
If you did, how did you fix them?

4
Resume the video
now
Step 1: Change the program

A. Change your program so that it now 1 print("What’s your name?")


looks like this example. 2 user = input()
3 print("Hello", user)

B. Before running your new program,


make a prediction about what might
happen at line 2 and what the output
might be.

6
Step 2: Run your program

Once you manage to run the program, 1 print("What’s your name?")


you should see this prompt: 2 user = input()
3 print("Hello", user)
What’s your name?

The program is still running: it is


executing the input function, which is
waiting for the user to type something
on the keyboard.

Type your name and press Enter. What


is the output of the program?

7
Step 3: Run your program again

Run your program again. 1 print("What’s your name?")


2 user = input()
Type a different name and press Enter.
3 print("Hello", user)
What is the output of the program?

8
Resume the video
now

You might also like