Skip to content
Learnearn.uk » Python Unit Home » lesson 1 – Print and Input

lesson 1 – Print and Input

Tutorial 1

Tutorial 2

Tutorial video part 2

Can’t access YouTube? Click here for the Google Drive Version

Want to know an even easier way of combining strings and variables? Take a look at F-Strings 🙂

Tutorial 3

What to know an even easier way of combining strings with variables? Check out the f-strings YouTube video below! Much easier and faster but only available if you are using Python 3.6 or newer.

 

 

Challenge 1

Challenge 1 – Nice to meet you

 

For your first challenge you need to ask the user their name and then print out a friendly greeting.

Can’t access YouTube? Click here for the Google Drive Version

Bronze

 Ask the user to input their name and print out a suitable response

 Save your code in a file called challenge1.py

Silver

  Clear the screen before your program starts and after it finishes

Gold

 Convert the input to title case ( capitalising the first letter of each word in the users name input)

 

 

2

Challenge 2 – Personal Info App

Can’t access YouTube? Click here

For this challenge you need to ask the users three questions and then display the user’s answers back to them.

Bronze

  Ask all the questions and display the answers back to the user as appropriate.

Silver

  Clear the screen before your program starts and after it finishes.

Gold

 Add an app title to the top of your app.

 Convert the input to title case ( capitalising the first letter of each word in the users name input)

3

Challenge 3 – Post Code app

Can’t access YouTube? Click here

In this challenge you need to make an app that asks the user to enter their postcode in 4 separate parts. It then display’s their postcode back to them.

Bronze

  Asking for their postcode in 4 parts and printing out their postcode.

Silver

 Clearing the screen and generally making things look pretty.

Gold

 Correct formatting of the postcode output on one line and capitalising the letters.  UK Postcode example –  PR3 4TH

4

Challenge 4 – Song Swapper App

In this app you need to write a program that asks for the user’s name and then adds their name in to a song’s lyrics.

Can’t see the video? Click here.

 

Bronze

 Correct input and printing out of the song

Silver

 Capitalising the first letter of the user’s input.

Gold

 Use the the sleep method(see below) and the system clear to improve your program

Sleep Method

I forgot this in the video…ooops! You import time, then use the time.sleep(seconds) to add a pause to your program!

import time

time.sleep(1)

Cheat Sheet

Cheat sheet

print(‘hello world’) – prints data out to the screen

name = input(“What’s your name”) – Asks the user for input and stores it in a named variable

name.title() Converts the user input into title case (adds a capital letter to the start of each word)

, (comma) – separates items in a print with a space

+(plus) – combines two items in a print without a space

\t – Adds a tab to a string of text

\n – Adds a new line to a string of text

import os – imports the os module, so you can use the os.system(‘clear’) to clear the screen

os.system(‘clear’) – clear’s the screen

import time – imports the time module, so you can use the sleep function

time.sleep(1) – gets the program to wait for a second in between lines of code.