SlideShare a Scribd company logo
1 of 34
www.teachingcomputing.com
Mastering Programming in Python
Lesson 1
• Introduction to the language, SEQUENCE variables, create a Chat bot
• Introduction SELECTION (if else statements)
• Introducing ITERATION (While loops)
• Introducing For Loops
• Use of Functions/Modular Programming
• Introducing Lists /Operations/List comprehension
• Use of Dictionaries
• String Manipulation
• File Handling – Reading and writing to CSV Files
• Importing and Exporting Files
• Transversing, Enumeration, Zip Merging
• Recursion
• Practical Programming
• Consolidation of all your skills – useful resources
• Includes Computer Science theory and Exciting themes for every
lesson including: Quantum Computing, History of Computing,
Future of storage, Brain Processing, and more …
Series Overview
*Please note that each lesson is not bound to a specific time (so it can be taken at your own pace)
Information/Theory/Discuss
Task (Code provided)
Challenge (DIY!)
Suggested Project/HW
In this lesson you will …
 First things first, BE INSPIRED! ..and get some perspective!
 Learn about the language: Python
 How to download Python 3 (and Pygame)
 create your very own chat bot in Python!
 learn about variables, sequence, programs, Alan
Turing and Artificial Intelligence
 Big Ideas: DNA Coding and Intelligent Design
 Challenge yourself to see if you can extend your
code!
 Random number and item generation
 Suggested videos: History of Computing
 Learn about mathematical and comparison operators
 Learn about the importance of Indentation in Python
*For this series we
assume students know
how to open, save and
run a python module.
Version: Python 3
First things first – Be inspired!
Before you start you need to be inspired by the wonderful
world of Computer Science and know that learning how to
program is going to be an amazing journey!
You need to pay attention, persevere, and practice. Soon
you’ll be good enough to create your own apps, games
and who knows what else!
The potential in this field is HUGE! Technology and
software is crucial to our every day lives. You can help
people, solve problems in small or big ways, and yes there
is also a lot of money to be made!
INFORMATION IS POWER! ….and learning how to code is going to give you power.
How will you use it? Be inspired …and you will really enjoy TeachingYourselfPython!
A big percentage of the world’s millionaires and billionaires
were computer scientists.
So much to think about! What will the future look like?
Any ideas how these two pictures are connected?
John Von Neumann was an amazing man (left). He was a child prodigy and legend has it he made his secondary
school maths teacher weep at his sheer genius even at that young age! Here he is with one of the world’s first
computers – it was called the MANIAC.
?
The Maniac …and the Hydrogen bomb!
The Maniac was the computer that was used to perform the calculations that led to the creation of the atomic bomb.
The devastation that followed is something you would have read all about ….
So …. information is POWER – but how we use that power is what is really important! Quantum Computing is
another emerging field that has great potential but also very great security risks. We’ll come to that in a later lesson.
>
Computer Science has also changed the world for good!
In small and big ways, computer science is continually providing opportunities to do good, solve problems and
change the world. Every field imaginable is now reliant on Computer Science. Lots to think about! Once you’re a
competent computer programmer, what will you use your skills to do?
Millions of apps are used to help people. Think of the
simple bus finder app. A simple but wonderful creation!
Computer Science has revolutionised the way the health
service works. Advances in all areas of medicine are
rapidly moving ahead thanks to clever software.
Dating sites and apps have helped millions find love
online! Without the internet they may have never found
each other!
Sophisticated Computer Software helps keep us safe.
Here’s a chap sitting at some air traffic control screens.
Video conferencing for business or just skyping your
grandma … communication has been hugely advanced
thanks to applications like SKYPE.
Getting started for the absolute beginnerSkip this if you have already installed python
https://www.python.org/downloads/
We have downloaded Python 3.4.3
You can read more about the
difference between Python 2 and 3
on the site.
Getting started for the absolute beginner
Visit the following site to
download python. The version
we use in these tutorials is:
Python 3.4.3
Once you’ve followed the
instructions and have python
on your computer, create a
short cut on your desktop (if
possible).
Open the IDLE SHELL and
create a new file (module)
see screenshot on the right.
You are ready to start programming in python,
Remember to save all files with the ending“.py”
Skip this if you have already installed python
Did you know?
Guido van Rossum, the guy on the right, created python!
He is a Dutch computer programmer and completed his
degree in the university of Amsterdam
He was employed by Google from 2005 until December
2012, where much of his time was spent developing the
Python language. In 2013, Van Rossum started working
for Dropbox.
Python is intended to be a highly readable language. It
has a relatively uncluttered visual layout, frequently using
English keywords where other languages use punctuation.
Guido van Rossum, the creator of Python
An important goal of the Python developers is making Python fun to use. This is
reflected in the origin of the name which comes from Monty Python
Want to create your own games?
You may also want to download Pygame. Pygame is basically a library of commands
that will help writing games be much easier.
Run the Python installer downloaded
from:
ProgramArcadeGames.com/python-
3.4.3.msi
http://programarcadegames.com/pytho
n-3.4.3.msi
Run the Pygame installer downloaded
from:
http://programarcadegames.com/pyga
me-1.9.2a0.win32-py3.4.msi
What is a program anyway?
Many algorithms (in our brain) are inbuilt
We eat, drink, speak, respond and appear to
have been pre-programmed to do so. There is
‘Free will’ too, but that’s a more philosophical
discussion.
DEFINITION: Algorithm = sequence of
instructions which performs a meaningful task
The very simplest definition is that: a program is just a sequence of
instructions.
Each of your cells contains what we call the
DNA CODE.
Interesting facts about DNA Code
The letters of the genetic alphabet – A, T, G,
and C – are meaningless on their own, but
they are combined into useful instructions in
genes.
The DNA code in your cells is like a library of instructions. It is probably the
most complex code we have ever come across. Is a programmer behind it?
The anatomy of a typical program
You can think of any program or system as
being comprised of these three parts:
Think about your very own brain: We don’t often realize it but our brains are
pretty awesome. The brain is storing values and processing data (as well as
producing outputs) all the time. Ever wondered how a lump of flesh (your
brain) stores data?!
INPUT – PROCESSING - OUTPUT
Inputs need to be stored, and that’s what we
are looking at in this first lesson. In Computing,
we need VARIABLES to store inputs
15 47
Number 1 Number 2
Consider the following example:
By simply looking at the screen, your brain has now STORED these two values.
But how do we get a programming language to ‘remember’ values?
The key word you need to remember is VARIABLE (or identifier)
Variable Name: NumberToStore FirstName
47 Joe
A useful analogy …
Variables are like storage boxes that can hold or store values in them.
In programming, we need to DECLARE Variables, also called Identifiers
Numbertostore = 47
Firstname = “Joe”
Task 1: Creating a Chat Bot using variables
1. Open a Python
Module
2. Copy and paste the
code on the right into
the module >>
3. Run the program to
see what it does
4. See if you can add
additional variables to
make it do more!
#This is a chatbot and this is a comment, not executed by the program
#Extend it to make the computer ask for your favourite movie and respond
accordingly!
print('Hello this is your computer...what is your favourite number?')
#Declaring our first variable below called 'computerfavnumber' and storing the
value 33
computerfavnumber=33
#We now declare a variable but set the variable to hold whatever the *user*
inputs into the program
favnumber=input()
print(favnumber + '...is a very nice number indeed. So...what is your name?')
name=input()
print('what a lovely name: ' + name + '...now, I will reveal what my favourite
number is:')
print (computerfavnumber)
Copy and paste the code below
Online chat bots you can check out!
http://www.mitsuku.com/ http://chatwithigod.com/
Try chatting with these bots. Can you tell you are not talking to a ‘real’ person.
How do you know? How could the program be improved?
Artificial Intelligence and the Turing Test
The Turing test is a test, developed by Alan Turing in
1950, of a machine's ability to exhibit intelligent behaviour
equivalent to, or indistinguishable from, that of a human.
A picture of the young Alan Turing
If you were chatting with a
computer would you be able to tell
the difference between it and a
real human being?
How?
What makes us different?
Will computers ever truly think?
Recent Developments in AI
https://en.wikipedia.org/wiki/Timeline_of_artificial_intelligence
You may find Wikipedia’s timeline of AI interesting reading (see link below)
Google’s artificial
intelligence (AI) software
has been developed to
the point that it is ready
to go head to head with
the world’s highest
ranked GO player.
This is seen as a pivotal moment for AI, similar to IBM’s DEEP BLUE beating Gary
Kasparov at chess!
Random Generation of stuff in Python
Random numbers are used A LOT in Computer science. Especially in gaming!
There is no such thing
as a truly random
number ...or that’s
what experts say any
way. But Python allows
you to generate random
stuff by importing a
code library that does
this for you!
The examples above generate random numbers and random items from a list.
*see if you can incorporate something random into your Chabot
Challenge: Extend the code and get
someone to try out your program!
Some suggestions but get
creative with your own
ideas!
1. Get the computer to ask the
user what his/her favourite
movie is and then respond
2. Declare a few other integer
variables and carry out an
addition!
3. Ask the user to think of a
colour in their head. Get the
computer to randomly
generate a colour from a
list.
4. What else will you do!?
#This is a chatbot and this is a comment, not executed by the program
#Extend it to make the computer ask for your favourite movie and respond
accordingly!
print('Hello this is your computer...what is your favourite number?')
#Declaring our first variable below called 'computerfavnumber' and storing the
value 33
computerfavnumber=33
#We now declare a variable but set the variable to hold whatever the *user*
inputs into the program
favnumber=input()
print(favnumber + '...is a very nice number indeed. So...what is your name?')
name=input()
print('what a lovely name: ' + name + '...now, I will reveal what my favourite
number is:')
print (computerfavnumber)
Copy and paste the code below
More on data types/variables in Python
Python has five standard data types (that can be
declared)
 NUMBERS
 STRING
 LIST
 TUPLE
 DICTIONARY
In this lesson you can primarily focus on
declaring numbers and strings.
Counter = 100 ‘An integer assignment
Pounds = 124.5 ‘A floating point
Name = “Joe Bloggs” ‘ A string
Here are some examples of numbers
Int long float complex
10 51924361 0.0 3.14
Python has four standard data
types (that can be declared)
 INT (signed integers)
 LONG (long integers also
represented in hex or octal)
 FLOAT (floating point real
numbers)
 COMPLEX (complex numbers)
• It is helpful to know some of the handy things
you can do with Strings. Just google Python 3
documentation and check out the official
tutorial. In a nutshell however, you can:
 Print strings to new lines
concatenate strings (stick them together!)
access individual characters in strings
Slicing: obtaining substrings from strings
Finding the length of a string
Go to https://docs.python.org/3.4/tutorial/introduction.html#strings to try more examples yourself!
Things you can do with strings.
• Watch this demo video
https://docs.python.org/3.4/tutorial/introduction.html#strings
Operator Operation Examples Code
List of common mathematical operators
?
?
?
?
?
?
?
Can you fill in the blanks?
Operator Meaning
List of common comparison operators
?
?
?
?
?
?
Can you fill in the blanks?
The following code which asks you how many weeks pregnant you are, and
calculates how many months that translates into, doesn’t work. Any idea why?
Defining input correctly – what’s wrong?
We need to tell the computer that we are working with numbers. You can do that by
specifying that the input is either a FLOAT float() or a plain old INTEGER int()
Defining input correctly – the solution!
if password == “moose”:
print("If password is ‘moose’, this will print.")
print(“This will print too")
print("And this.")
print(“this will confuse the computer”)
print("This will always print because it is not
indented.")
In Python you can have blocks of code grouped together. You know when one block
begins and ends by checking out the indentation of the lines of code.
In Python, INDENTATION matters!
There are some simple rules for blocks (indentation)
1. When the indentation increases this indicates the BEGINNING of a block
2. Blocks can contain other blocks!
3. When the indentation decreases to a zero, blocks end!
Note the examples below:
Block 1 = Line 4
Block 2 = Line 6
Block 3 = Line 8
Useful Videos to watch on covered topics
https://youtu.be/poLZqn2_dv4 https://youtu.be/667ZeuZ0Q8M
Exploring Artificial Intelligence today Recommended video on Python Variables
An entertaining history of Computing
Triumph of the Nerds – Part 1/2/3
•Triumph of the Nerds Part 1
•Triumph of the Nerds Part 2
•Triumph of the Nerds Part 3
What next? Be inspired to learn!
The field of Computing and Computer Science is at the
forefront of everything that is happening today.
Just think about it … where would we be without
computers and software?
And what’s more, things are moving FAST! The advances
in technology are stunning. And the capacity to make
money, innovate and most of all help people, is HUGE!
And what’s more, things are moving FAST! The advances
in technology are stunning. And the capacity to make
money, innovate and most of all help people, is HUGE!
YOU can start here! By
learning how to
program! And reading
around the subject and
taking an interest in past,
current and future
developments
Suggested Project / HW / Research
 Create a research information point on Alan Turing.
 Basic facts about him
 Achievements
 Turing Test
 His involvement in code breaking at Bletchley park
 High level languages use variables as memory locations –but how does a
computer, at its very lowest level (Binary 1s and 0s) store information? Write a
short essay, based on your research, to explain how computers store
 Numbers
 Text
 Images
 Sound/Video
Useful links and additional reading
http://www.python-course.eu/variables.php
http://www.programiz.com/python-programming/variables-datatypes
http://www.tutorialspoint.com/python/python_variable_types.htm
https://en.wikibooks.org/wiki/Python_Programming/Variables_and_Strings

More Related Content

What's hot

Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data sciencedeepak teja
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning ParrotAI
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonInformation Technology
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programmingSrinivas Narasegouda
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introductionstn_tkiller
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data AnalyticsEdureka!
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTESNi
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installingMohd Sajjad
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | EdurekaEdureka!
 
Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)IoT Code Lab
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming LanguageTahani Al-Manie
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming LanguageLaxman Puri
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 

What's hot (20)

How To Tame Python
How To Tame PythonHow To Tame Python
How To Tame Python
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of Python
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Python basics
Python basicsPython basics
Python basics
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introduction
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 
Python ppt
Python pptPython ppt
Python ppt
 
Python_in_Detail
Python_in_DetailPython_in_Detail
Python_in_Detail
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)
 
Python
PythonPython
Python
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 

Viewers also liked

Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)benbrowning
 
Mr Britland's Open Source KS3 Computing Curriculum
Mr Britland's Open Source KS3 Computing Curriculum Mr Britland's Open Source KS3 Computing Curriculum
Mr Britland's Open Source KS3 Computing Curriculum Matt Britland
 
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014Mr Britland’s KS3 Computing Curriculum V2: 2013-2014
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014Matt Britland
 
Lesson 3 media stereotypes worksheet
Lesson 3   media stereotypes worksheetLesson 3   media stereotypes worksheet
Lesson 3 media stereotypes worksheetKeanah Osborne
 
2016:5:23(看護過程)
2016:5:23(看護過程)2016:5:23(看護過程)
2016:5:23(看護過程)律子 栗原
 
AS Macro Question - Falling Unemployment
AS Macro Question - Falling UnemploymentAS Macro Question - Falling Unemployment
AS Macro Question - Falling UnemploymentEton College
 
Meetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en pythonMeetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en pythonArthur Lutz
 
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Matt Harrison
 
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Chia-Chi Chang
 
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to JavaJava OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to JavaOUM SAOKOSAL
 

Viewers also liked (20)

Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)
 
Mr Britland's Open Source KS3 Computing Curriculum
Mr Britland's Open Source KS3 Computing Curriculum Mr Britland's Open Source KS3 Computing Curriculum
Mr Britland's Open Source KS3 Computing Curriculum
 
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014Mr Britland’s KS3 Computing Curriculum V2: 2013-2014
Mr Britland’s KS3 Computing Curriculum V2: 2013-2014
 
さくら
さくらさくら
さくら
 
Lesson 3 media stereotypes worksheet
Lesson 3   media stereotypes worksheetLesson 3   media stereotypes worksheet
Lesson 3 media stereotypes worksheet
 
排泄(2016:5:16)
排泄(2016:5:16)排泄(2016:5:16)
排泄(2016:5:16)
 
清潔(2016:5:2)
清潔(2016:5:2)清潔(2016:5:2)
清潔(2016:5:2)
 
2016:4:25(食事)
2016:4:25(食事) 2016:4:25(食事)
2016:4:25(食事)
 
環境(2016:5:2)
環境(2016:5:2)環境(2016:5:2)
環境(2016:5:2)
 
Stereotypes worksheet
Stereotypes worksheetStereotypes worksheet
Stereotypes worksheet
 
摂食障害
摂食障害摂食障害
摂食障害
 
2016:4:18 vs測定
2016:4:18 vs測定2016:4:18 vs測定
2016:4:18 vs測定
 
2016:5:23(看護過程)
2016:5:23(看護過程)2016:5:23(看護過程)
2016:5:23(看護過程)
 
AS Macro Question - Falling Unemployment
AS Macro Question - Falling UnemploymentAS Macro Question - Falling Unemployment
AS Macro Question - Falling Unemployment
 
Introduction to Advanced Javascript
Introduction to Advanced JavascriptIntroduction to Advanced Javascript
Introduction to Advanced Javascript
 
Meetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en pythonMeetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en python
 
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
 
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)
 
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to JavaJava OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to Java
 
Python - Lecture 1
Python - Lecture 1Python - Lecture 1
Python - Lecture 1
 

Similar to Mastering python lesson1

Pythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptxPythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptxMrHackerxD
 
Rrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentRrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentSheri Elliott
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptxHaythamBarakeh1
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-introIshaq Ali
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
Introduction to coding and Python
Introduction to coding and PythonIntroduction to coding and Python
Introduction to coding and PythonHaris NP
 
Programming beyond cs
Programming beyond csProgramming beyond cs
Programming beyond csuditproject
 
Web2.0 And You Ppt
Web2.0 And You PptWeb2.0 And You Ppt
Web2.0 And You PptLisa Read
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With PythonPraveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()Blue Elephant Consulting
 

Similar to Mastering python lesson1 (20)

Pythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptxPythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptx
 
Rrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentRrw02 Week 1 Assignment
Rrw02 Week 1 Assignment
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
py4inf-01-intro.ppt
py4inf-01-intro.pptpy4inf-01-intro.ppt
py4inf-01-intro.ppt
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
Introduction to coding and Python
Introduction to coding and PythonIntroduction to coding and Python
Introduction to coding and Python
 
Python
PythonPython
Python
 
AI & ML
AI & MLAI & ML
AI & ML
 
Programming beyond cs
Programming beyond csProgramming beyond cs
Programming beyond cs
 
Learning to code in 2020
Learning to code in 2020Learning to code in 2020
Learning to code in 2020
 
Python
PythonPython
Python
 
Web2.0 And You Ppt
Web2.0 And You PptWeb2.0 And You Ppt
Web2.0 And You Ppt
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With Python
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
La Pecera 4
La Pecera 4La Pecera 4
La Pecera 4
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Python basics
Python basicsPython basics
Python basics
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 

Recently uploaded

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

Recently uploaded (20)

ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 

Mastering python lesson1

  • 2. • Introduction to the language, SEQUENCE variables, create a Chat bot • Introduction SELECTION (if else statements) • Introducing ITERATION (While loops) • Introducing For Loops • Use of Functions/Modular Programming • Introducing Lists /Operations/List comprehension • Use of Dictionaries • String Manipulation • File Handling – Reading and writing to CSV Files • Importing and Exporting Files • Transversing, Enumeration, Zip Merging • Recursion • Practical Programming • Consolidation of all your skills – useful resources • Includes Computer Science theory and Exciting themes for every lesson including: Quantum Computing, History of Computing, Future of storage, Brain Processing, and more … Series Overview *Please note that each lesson is not bound to a specific time (so it can be taken at your own pace) Information/Theory/Discuss Task (Code provided) Challenge (DIY!) Suggested Project/HW
  • 3. In this lesson you will …  First things first, BE INSPIRED! ..and get some perspective!  Learn about the language: Python  How to download Python 3 (and Pygame)  create your very own chat bot in Python!  learn about variables, sequence, programs, Alan Turing and Artificial Intelligence  Big Ideas: DNA Coding and Intelligent Design  Challenge yourself to see if you can extend your code!  Random number and item generation  Suggested videos: History of Computing  Learn about mathematical and comparison operators  Learn about the importance of Indentation in Python *For this series we assume students know how to open, save and run a python module. Version: Python 3
  • 4. First things first – Be inspired! Before you start you need to be inspired by the wonderful world of Computer Science and know that learning how to program is going to be an amazing journey! You need to pay attention, persevere, and practice. Soon you’ll be good enough to create your own apps, games and who knows what else! The potential in this field is HUGE! Technology and software is crucial to our every day lives. You can help people, solve problems in small or big ways, and yes there is also a lot of money to be made! INFORMATION IS POWER! ….and learning how to code is going to give you power. How will you use it? Be inspired …and you will really enjoy TeachingYourselfPython! A big percentage of the world’s millionaires and billionaires were computer scientists. So much to think about! What will the future look like?
  • 5. Any ideas how these two pictures are connected? John Von Neumann was an amazing man (left). He was a child prodigy and legend has it he made his secondary school maths teacher weep at his sheer genius even at that young age! Here he is with one of the world’s first computers – it was called the MANIAC. ?
  • 6. The Maniac …and the Hydrogen bomb! The Maniac was the computer that was used to perform the calculations that led to the creation of the atomic bomb. The devastation that followed is something you would have read all about …. So …. information is POWER – but how we use that power is what is really important! Quantum Computing is another emerging field that has great potential but also very great security risks. We’ll come to that in a later lesson. >
  • 7. Computer Science has also changed the world for good! In small and big ways, computer science is continually providing opportunities to do good, solve problems and change the world. Every field imaginable is now reliant on Computer Science. Lots to think about! Once you’re a competent computer programmer, what will you use your skills to do? Millions of apps are used to help people. Think of the simple bus finder app. A simple but wonderful creation! Computer Science has revolutionised the way the health service works. Advances in all areas of medicine are rapidly moving ahead thanks to clever software. Dating sites and apps have helped millions find love online! Without the internet they may have never found each other! Sophisticated Computer Software helps keep us safe. Here’s a chap sitting at some air traffic control screens. Video conferencing for business or just skyping your grandma … communication has been hugely advanced thanks to applications like SKYPE.
  • 8. Getting started for the absolute beginnerSkip this if you have already installed python https://www.python.org/downloads/ We have downloaded Python 3.4.3 You can read more about the difference between Python 2 and 3 on the site.
  • 9. Getting started for the absolute beginner Visit the following site to download python. The version we use in these tutorials is: Python 3.4.3 Once you’ve followed the instructions and have python on your computer, create a short cut on your desktop (if possible). Open the IDLE SHELL and create a new file (module) see screenshot on the right. You are ready to start programming in python, Remember to save all files with the ending“.py” Skip this if you have already installed python
  • 10. Did you know? Guido van Rossum, the guy on the right, created python! He is a Dutch computer programmer and completed his degree in the university of Amsterdam He was employed by Google from 2005 until December 2012, where much of his time was spent developing the Python language. In 2013, Van Rossum started working for Dropbox. Python is intended to be a highly readable language. It has a relatively uncluttered visual layout, frequently using English keywords where other languages use punctuation. Guido van Rossum, the creator of Python An important goal of the Python developers is making Python fun to use. This is reflected in the origin of the name which comes from Monty Python
  • 11. Want to create your own games? You may also want to download Pygame. Pygame is basically a library of commands that will help writing games be much easier. Run the Python installer downloaded from: ProgramArcadeGames.com/python- 3.4.3.msi http://programarcadegames.com/pytho n-3.4.3.msi Run the Pygame installer downloaded from: http://programarcadegames.com/pyga me-1.9.2a0.win32-py3.4.msi
  • 12. What is a program anyway? Many algorithms (in our brain) are inbuilt We eat, drink, speak, respond and appear to have been pre-programmed to do so. There is ‘Free will’ too, but that’s a more philosophical discussion. DEFINITION: Algorithm = sequence of instructions which performs a meaningful task The very simplest definition is that: a program is just a sequence of instructions. Each of your cells contains what we call the DNA CODE.
  • 13. Interesting facts about DNA Code The letters of the genetic alphabet – A, T, G, and C – are meaningless on their own, but they are combined into useful instructions in genes. The DNA code in your cells is like a library of instructions. It is probably the most complex code we have ever come across. Is a programmer behind it?
  • 14. The anatomy of a typical program You can think of any program or system as being comprised of these three parts: Think about your very own brain: We don’t often realize it but our brains are pretty awesome. The brain is storing values and processing data (as well as producing outputs) all the time. Ever wondered how a lump of flesh (your brain) stores data?! INPUT – PROCESSING - OUTPUT Inputs need to be stored, and that’s what we are looking at in this first lesson. In Computing, we need VARIABLES to store inputs
  • 15. 15 47 Number 1 Number 2 Consider the following example: By simply looking at the screen, your brain has now STORED these two values. But how do we get a programming language to ‘remember’ values? The key word you need to remember is VARIABLE (or identifier)
  • 16. Variable Name: NumberToStore FirstName 47 Joe A useful analogy … Variables are like storage boxes that can hold or store values in them. In programming, we need to DECLARE Variables, also called Identifiers Numbertostore = 47 Firstname = “Joe”
  • 17. Task 1: Creating a Chat Bot using variables 1. Open a Python Module 2. Copy and paste the code on the right into the module >> 3. Run the program to see what it does 4. See if you can add additional variables to make it do more! #This is a chatbot and this is a comment, not executed by the program #Extend it to make the computer ask for your favourite movie and respond accordingly! print('Hello this is your computer...what is your favourite number?') #Declaring our first variable below called 'computerfavnumber' and storing the value 33 computerfavnumber=33 #We now declare a variable but set the variable to hold whatever the *user* inputs into the program favnumber=input() print(favnumber + '...is a very nice number indeed. So...what is your name?') name=input() print('what a lovely name: ' + name + '...now, I will reveal what my favourite number is:') print (computerfavnumber) Copy and paste the code below
  • 18. Online chat bots you can check out! http://www.mitsuku.com/ http://chatwithigod.com/ Try chatting with these bots. Can you tell you are not talking to a ‘real’ person. How do you know? How could the program be improved?
  • 19. Artificial Intelligence and the Turing Test The Turing test is a test, developed by Alan Turing in 1950, of a machine's ability to exhibit intelligent behaviour equivalent to, or indistinguishable from, that of a human. A picture of the young Alan Turing If you were chatting with a computer would you be able to tell the difference between it and a real human being? How? What makes us different? Will computers ever truly think?
  • 20. Recent Developments in AI https://en.wikipedia.org/wiki/Timeline_of_artificial_intelligence You may find Wikipedia’s timeline of AI interesting reading (see link below) Google’s artificial intelligence (AI) software has been developed to the point that it is ready to go head to head with the world’s highest ranked GO player. This is seen as a pivotal moment for AI, similar to IBM’s DEEP BLUE beating Gary Kasparov at chess!
  • 21. Random Generation of stuff in Python Random numbers are used A LOT in Computer science. Especially in gaming! There is no such thing as a truly random number ...or that’s what experts say any way. But Python allows you to generate random stuff by importing a code library that does this for you! The examples above generate random numbers and random items from a list. *see if you can incorporate something random into your Chabot
  • 22. Challenge: Extend the code and get someone to try out your program! Some suggestions but get creative with your own ideas! 1. Get the computer to ask the user what his/her favourite movie is and then respond 2. Declare a few other integer variables and carry out an addition! 3. Ask the user to think of a colour in their head. Get the computer to randomly generate a colour from a list. 4. What else will you do!? #This is a chatbot and this is a comment, not executed by the program #Extend it to make the computer ask for your favourite movie and respond accordingly! print('Hello this is your computer...what is your favourite number?') #Declaring our first variable below called 'computerfavnumber' and storing the value 33 computerfavnumber=33 #We now declare a variable but set the variable to hold whatever the *user* inputs into the program favnumber=input() print(favnumber + '...is a very nice number indeed. So...what is your name?') name=input() print('what a lovely name: ' + name + '...now, I will reveal what my favourite number is:') print (computerfavnumber) Copy and paste the code below
  • 23. More on data types/variables in Python Python has five standard data types (that can be declared)  NUMBERS  STRING  LIST  TUPLE  DICTIONARY In this lesson you can primarily focus on declaring numbers and strings. Counter = 100 ‘An integer assignment Pounds = 124.5 ‘A floating point Name = “Joe Bloggs” ‘ A string Here are some examples of numbers Int long float complex 10 51924361 0.0 3.14 Python has four standard data types (that can be declared)  INT (signed integers)  LONG (long integers also represented in hex or octal)  FLOAT (floating point real numbers)  COMPLEX (complex numbers)
  • 24. • It is helpful to know some of the handy things you can do with Strings. Just google Python 3 documentation and check out the official tutorial. In a nutshell however, you can:  Print strings to new lines concatenate strings (stick them together!) access individual characters in strings Slicing: obtaining substrings from strings Finding the length of a string Go to https://docs.python.org/3.4/tutorial/introduction.html#strings to try more examples yourself! Things you can do with strings. • Watch this demo video https://docs.python.org/3.4/tutorial/introduction.html#strings
  • 25. Operator Operation Examples Code List of common mathematical operators ? ? ? ? ? ? ? Can you fill in the blanks?
  • 26. Operator Meaning List of common comparison operators ? ? ? ? ? ? Can you fill in the blanks?
  • 27. The following code which asks you how many weeks pregnant you are, and calculates how many months that translates into, doesn’t work. Any idea why? Defining input correctly – what’s wrong?
  • 28. We need to tell the computer that we are working with numbers. You can do that by specifying that the input is either a FLOAT float() or a plain old INTEGER int() Defining input correctly – the solution!
  • 29. if password == “moose”: print("If password is ‘moose’, this will print.") print(“This will print too") print("And this.") print(“this will confuse the computer”) print("This will always print because it is not indented.") In Python you can have blocks of code grouped together. You know when one block begins and ends by checking out the indentation of the lines of code. In Python, INDENTATION matters! There are some simple rules for blocks (indentation) 1. When the indentation increases this indicates the BEGINNING of a block 2. Blocks can contain other blocks! 3. When the indentation decreases to a zero, blocks end! Note the examples below: Block 1 = Line 4 Block 2 = Line 6 Block 3 = Line 8
  • 30. Useful Videos to watch on covered topics https://youtu.be/poLZqn2_dv4 https://youtu.be/667ZeuZ0Q8M Exploring Artificial Intelligence today Recommended video on Python Variables
  • 31. An entertaining history of Computing Triumph of the Nerds – Part 1/2/3 •Triumph of the Nerds Part 1 •Triumph of the Nerds Part 2 •Triumph of the Nerds Part 3
  • 32. What next? Be inspired to learn! The field of Computing and Computer Science is at the forefront of everything that is happening today. Just think about it … where would we be without computers and software? And what’s more, things are moving FAST! The advances in technology are stunning. And the capacity to make money, innovate and most of all help people, is HUGE! And what’s more, things are moving FAST! The advances in technology are stunning. And the capacity to make money, innovate and most of all help people, is HUGE! YOU can start here! By learning how to program! And reading around the subject and taking an interest in past, current and future developments
  • 33. Suggested Project / HW / Research  Create a research information point on Alan Turing.  Basic facts about him  Achievements  Turing Test  His involvement in code breaking at Bletchley park  High level languages use variables as memory locations –but how does a computer, at its very lowest level (Binary 1s and 0s) store information? Write a short essay, based on your research, to explain how computers store  Numbers  Text  Images  Sound/Video
  • 34. Useful links and additional reading http://www.python-course.eu/variables.php http://www.programiz.com/python-programming/variables-datatypes http://www.tutorialspoint.com/python/python_variable_types.htm https://en.wikibooks.org/wiki/Python_Programming/Variables_and_Strings

Editor's Notes

  1. Associated Resource: Python GUI Programming: See www.teachingcomputing.com (resources overview) for more information
  2. Associated Resource: Python GUI Programming: See www.teachingcomputing.com (resources overview) for more information
  3. Image source: http://www.peardeck.com
  4. Image(s) source: itechfuture.com
  5. Image(s) source: Wikipedia.com
  6. Image(s) source: manhattanprojectvoices.org
  7. Image(s) source: manhattanprojectvoices.org, Wikipedia.com,
  8. Image(s) source: Wikipedia
  9. We’ll be using Pygame at a later stage. (it’s useful to make sure you have downloaded the correct versions. Remember we are working with Python 3)
  10. Image(s) source: Dreamstime.com (royalty free images)
  11. Image(s) source: Dreamstime.com (royalty free images)
  12. Image(s) source: 123rf.com
  13. Image(s) and information source: Wikipedia
  14. Source: taken from BBC news article that can be read here: http://www.bbc.co.uk/news/35501537
  15. Image Source: lifewithjustin.wordpress.com
  16. Image(s) source: Wikipedia
  17. Image(s) source: Wikipedia