THIS MAY REQUIRE 2 ONE HOUR LESSONS
STARTER
With your partner discuss the following statement "Computers only do two things but do them extremely well". Note your ideas in your learning blog.
Today we are going to start looking at the basics of programming using Python. THIS WILL BE THE ONLY language we will teach towards the controlled assessment.
Learning Outcomes
You will learn:
- To describe the Python programming language and it's features
- To use the interactive mode of IDLE
- To display text on the screen
- To describe keyboard shortcuts
- To use escape sequences
- To use ASCII art
Python
TASK 1
As a class we are going to look at the following questions about Python:
Python was released in 2010
|
True or False
|
Python was named after the TV series “Monty Python’s Flying Circus”
|
True or False
|
Python is proprietary software which is expensive to buy
|
True or False
|
Python was written by Bill Gates
|
True or False
|
YouTube is written in Python
|
Python Modes
There are two to modes to Python. An interactive mode where you can test code and a scripting mode where you will write programs.
TASK 2
In interactive mode write a program to print "Hello Dave".
TASK 3
In interactive mode write a program that prints your name on the screen.
TASK 4
Copy and run this program:
print ("hello"*100)
TASK 5
In interactive mode now write a program that prints your name one hundred times.
TASK 6
Make a note of these keyboard shortcuts:
|
TASK 7
Copy and run this program:
print("This is the end")
print("Hold your breath and count to ten”)
print("Feel the earth move and then”)
print("Hear my heart burst again”)
TASK 8
Write a program that prints a verse of your favourite song.
TASK 9
Copy and run this program:
print("the rain falls","from the sky")
Now answer these questions:
What happens?
What effect does the "," have?
TASK 10
Escape sequences can be used to alter how the information is displayed on the screen. An escape sequence is a back slash “\”.
Experiment with these escape sequences and complete the table.
print("\tQuestion what goes woof\t\tdogs\t\t\trabbits")
print("\n\nwhat kind of snake is good at maths?\n\nAn adder\n\n")
print("\n\nGoodbye\n\n")
Hint: Use alt p to display the last command entered in the IDLE shell.
Escape sequence
|
Effect
|
\t
| |
\n
| |
\\
| |
\’
| |
\”
|
TASK 11
Print this text using just one line of code.
Help, I need somebody
Help, not just anybody
Help, you know, I need someone
TASK 12
Write a program using print commands to display your initials five characters high on the screen.
X X X X
XX X X X
X X X XXXXXX
X XX X X
X X X X
http://brucerturnell.blogspot.co.uk/
ReplyDeleteMy Homework for 15/9