Wednesday, 16 December 2015

Python Lesson 4 (last one before Christmas!)

L/O - To understand and be able to create and assign variables in Python

Outcomes:

Red - You will be able to copy a program that uses a variable
Amber - You will be able to identify and explain what a variable is
Green - You will be able to independently create a simple program that uses variables


Main Task



print ("Hello")
name = input ("What's your name?")
print ("Hello " + name)
x = int(input ("please give me a number "))
y = int(input ("Please give me another number "))
print (x + y)
place = input ("Where are you from? ")
work = input ("So " + name + " from " + place.title() + ", what do you do for work? ")
age = input ("What is your age?")
if type(age) == int:
else:
    print ("That's not a number!!")
if int (age) <= 60:
    print ("How young!")

Save the code into your Python folder and call it age

Can you add to this code???

EXTENSION TASK (Click on the image below):

No comments:

Post a Comment

Elite of the Week

Create your free online surveys with SurveyMonkey , the world's leading questionnaire tool.

Year 10/11 Deadlines