SlideShare a Scribd company logo
1 of 4
3-1: Introduction to Python
Objectives:
 Basic familiarity with the IDLE tool
 Basic data manipulation using Python syntax
All the software for this sequence should already be on the Pi, as part of
Raspbian. Verify that the IDLE tool is available in the X Windows System.
What's the point? Giving the computer instructions, to tell it to do exactly what
you want. It can't do what it doesn't know, so we humans have to decide how
to teach it, and craft our programs appropriately. Games, web, documents,
security, music, virtually anything is possible.
Basic data manipulation:
Type a number into IDLE and press enter. It examines what you told it, does it,
and tell you the result. In this case, it tells you what number you
entered...because there is nothing else to do.
Try some basic math, e.g. 1 + 1. It tells you the answer is 2. Some basic
operators are as follows:
 + (addition)
 - (subtraction)
 * (multiplication)
 / (division)
 % (modulo or remainder, as in 10 mod 3 == 1)
 ** (power, as in 4**2 = 4 squared = 16)
Try 10 / 3. Notice that the answer is 3. Now try 10 / 3.0. Notice that the answer is
3.3333333. If you tell it that you care about decimal places, you get decimal
numbers. Otherwise, you get integers.
Take a few minutes to use Python as a calculator. There are some editing
shortcuts that might also help at this point.
 Ctrl-End will always get you back to the current prompt, if you move the
cursor elsewhere.
 Alt-p will put the previous entry at the prompt again. If you hit it again, it
will cycle through entries previous to that as well.
 Alt-n will go to the next entry. This is particularly useful if you are looking for
something in particular with Alt-p, but you pass it.
 Ctrl-c will interrupt what is currently happening, clear the current
programming entry, and put your cursor at the prompt. If you don't know
what is happening, this can help you reset to a known state.
 Copy and paste do work. Be careful of indentation if you choose to
paste, and also be careful of the >>> characters.
Variables:
(Attendees who have done some algebra will find this much easier.)
In its basic form, a variable is a box. You can put things in the box, you can take
things out of the box, you can forget what's inside, and then look to see what it
is. When you carry it around, though, it's still a box. Boxes come in different
shapes and sizes, but all of ours are going to be the same size for now.
Let's put the number 12 in a variable, by telling Python “x = 12” – notice that
Python responds by telling us absolutely nothing. Now, let's ask Python what x is:
>>> x
12
>>>
Next, let's use our variable in some arithmetic expressions. Try things like x + 1,
x**x, 42 / x, etc. Notice that it works just like the number 12.
Now, let's change x to something else. Try the following:
>>> x = x - 3
>>>
We can change what's in the box without actually looking at it, which is
convenient. Have a look to see what its value currently is.
>>> x
9
>>>
You can call variables pretty much whatever you like, as long as you use letters
and no spaces. Numbers are okay within a variable name, and multi-word
variable names are usually distinguished by capitalizing all but the first one. So,
the following are all valid: x, y, xy, george, john, paul, ringo, octopus,
thisIsAVeryLongVariableName, theSong, grocerylist. Be descriptive, and try to
label your boxes so you know what's inside them.
Strings:
We've seen how Python can act as a calculator with numbers, and how we can
use words to name variables. What if we want Python to talk to us? If you try to
tell it “hello” you get a nasty-looking error:
>>> hello
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
hello
NameError: name 'hello' is not defined
>>>
Such errors are commonplace and not to be feared. They simply indicate that
something went wrong, and usually provide useful information for fixing the
problem. In this case, Python doesn't know anything about hello – it is trying to
interpret it as a variable or other identifier. We want it to be treated as a literal
string of characters, so we have to put it inside quotation marks:
>>> "hello"
'hello'
>>>
Notice that when Python tells us 'hello' it is between a pair of apostrophes, also
called single quotes. Either single or double quotation marks are acceptable, as
long as they match.
We can also add strings together, and we can put them in variables. For
example:
>>> y = 'hello'
>>> y
'hello'
>>> y + " world”
'hello world'
Remember how we have the number 9 in x at the moment? It is often useful to
insert the values of numeric variables into strings, but to do so we must use a
different character: the backtick. It points toward the right, while the
apostrophe On US keyboards, it is usually on the same key as the tilde.
>>> y + " " + 'world' + `x`
'hello world9'
>>>
This may be a reasonable stopping point – the attention to detail required for
success throughout these examples may take some effort for attendees,
especially if you have some who do not have experience with algebra. Pack
up the Pi kits as normal.

More Related Content

What's hot (19)

Python language data types
Python language data typesPython language data types
Python language data types
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Introduction to Python - Training for Kids
Introduction to Python - Training for KidsIntroduction to Python - Training for Kids
Introduction to Python - Training for Kids
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1CPAP.com Introduction to Coding: Part 1
CPAP.com Introduction to Coding: Part 1
 
Python Basics
Python Basics Python Basics
Python Basics
 
PROLOG: Cuts And Negation In Prolog
PROLOG: Cuts And Negation In PrologPROLOG: Cuts And Negation In Prolog
PROLOG: Cuts And Negation In Prolog
 
User defined data type
User defined data typeUser defined data type
User defined data type
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data Types
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
C++ data types
C++ data typesC++ data types
C++ data types
 

Similar to python isn't just a snake

ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxpriestmanmable
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
Notes1
Notes1Notes1
Notes1hccit
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming LanguageDipankar Achinta
 
Phyton Learning extracts
Phyton Learning extracts Phyton Learning extracts
Phyton Learning extracts Pavan Babu .G
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfEjazAlam23
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Magic 8 ball prorgramming or structure is fun
Magic 8 ball prorgramming or structure is funMagic 8 ball prorgramming or structure is fun
Magic 8 ball prorgramming or structure is fungeekinlibrariansclothing
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review GuideBenjamin Kissinger
 
Brogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and GitBrogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and GitRon Reiter
 
Python PPT by Sushil Sir.pptx
Python PPT by Sushil Sir.pptxPython PPT by Sushil Sir.pptx
Python PPT by Sushil Sir.pptxsushil155005
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computingGo Asgard
 

Similar to python isn't just a snake (20)

Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Python basics
Python basicsPython basics
Python basics
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Notes1
Notes1Notes1
Notes1
 
Python
PythonPython
Python
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
Introduction to Computing
Introduction to ComputingIntroduction to Computing
Introduction to Computing
 
Phyton Learning extracts
Phyton Learning extracts Phyton Learning extracts
Phyton Learning extracts
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdf
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
M C6java2
M C6java2M C6java2
M C6java2
 
Magic 8 ball prorgramming or structure is fun
Magic 8 ball prorgramming or structure is funMagic 8 ball prorgramming or structure is fun
Magic 8 ball prorgramming or structure is fun
 
Magic 8 ball putting it all together
Magic 8 ball  putting it all togetherMagic 8 ball  putting it all together
Magic 8 ball putting it all together
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
 
Brogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and GitBrogramming - Python, Bash for Data Processing, and Git
Brogramming - Python, Bash for Data Processing, and Git
 
Python PPT by Sushil Sir.pptx
Python PPT by Sushil Sir.pptxPython PPT by Sushil Sir.pptx
Python PPT by Sushil Sir.pptx
 
python
pythonpython
python
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computing
 

Recently uploaded

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
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
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
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
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
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
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
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
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
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...
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
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
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

python isn't just a snake

  • 1. 3-1: Introduction to Python Objectives:  Basic familiarity with the IDLE tool  Basic data manipulation using Python syntax All the software for this sequence should already be on the Pi, as part of Raspbian. Verify that the IDLE tool is available in the X Windows System. What's the point? Giving the computer instructions, to tell it to do exactly what you want. It can't do what it doesn't know, so we humans have to decide how to teach it, and craft our programs appropriately. Games, web, documents, security, music, virtually anything is possible. Basic data manipulation: Type a number into IDLE and press enter. It examines what you told it, does it, and tell you the result. In this case, it tells you what number you entered...because there is nothing else to do. Try some basic math, e.g. 1 + 1. It tells you the answer is 2. Some basic operators are as follows:  + (addition)  - (subtraction)  * (multiplication)  / (division)  % (modulo or remainder, as in 10 mod 3 == 1)  ** (power, as in 4**2 = 4 squared = 16) Try 10 / 3. Notice that the answer is 3. Now try 10 / 3.0. Notice that the answer is 3.3333333. If you tell it that you care about decimal places, you get decimal numbers. Otherwise, you get integers. Take a few minutes to use Python as a calculator. There are some editing shortcuts that might also help at this point.  Ctrl-End will always get you back to the current prompt, if you move the cursor elsewhere.  Alt-p will put the previous entry at the prompt again. If you hit it again, it will cycle through entries previous to that as well.  Alt-n will go to the next entry. This is particularly useful if you are looking for something in particular with Alt-p, but you pass it.  Ctrl-c will interrupt what is currently happening, clear the current programming entry, and put your cursor at the prompt. If you don't know
  • 2. what is happening, this can help you reset to a known state.  Copy and paste do work. Be careful of indentation if you choose to paste, and also be careful of the >>> characters. Variables: (Attendees who have done some algebra will find this much easier.) In its basic form, a variable is a box. You can put things in the box, you can take things out of the box, you can forget what's inside, and then look to see what it is. When you carry it around, though, it's still a box. Boxes come in different shapes and sizes, but all of ours are going to be the same size for now. Let's put the number 12 in a variable, by telling Python “x = 12” – notice that Python responds by telling us absolutely nothing. Now, let's ask Python what x is: >>> x 12 >>> Next, let's use our variable in some arithmetic expressions. Try things like x + 1, x**x, 42 / x, etc. Notice that it works just like the number 12. Now, let's change x to something else. Try the following: >>> x = x - 3 >>> We can change what's in the box without actually looking at it, which is convenient. Have a look to see what its value currently is. >>> x 9 >>> You can call variables pretty much whatever you like, as long as you use letters and no spaces. Numbers are okay within a variable name, and multi-word variable names are usually distinguished by capitalizing all but the first one. So, the following are all valid: x, y, xy, george, john, paul, ringo, octopus, thisIsAVeryLongVariableName, theSong, grocerylist. Be descriptive, and try to label your boxes so you know what's inside them.
  • 3. Strings: We've seen how Python can act as a calculator with numbers, and how we can use words to name variables. What if we want Python to talk to us? If you try to tell it “hello” you get a nasty-looking error: >>> hello Traceback (most recent call last): File "<pyshell#22>", line 1, in <module> hello NameError: name 'hello' is not defined >>> Such errors are commonplace and not to be feared. They simply indicate that something went wrong, and usually provide useful information for fixing the problem. In this case, Python doesn't know anything about hello – it is trying to interpret it as a variable or other identifier. We want it to be treated as a literal string of characters, so we have to put it inside quotation marks: >>> "hello" 'hello' >>> Notice that when Python tells us 'hello' it is between a pair of apostrophes, also called single quotes. Either single or double quotation marks are acceptable, as long as they match. We can also add strings together, and we can put them in variables. For example: >>> y = 'hello'
  • 4. >>> y 'hello' >>> y + " world” 'hello world' Remember how we have the number 9 in x at the moment? It is often useful to insert the values of numeric variables into strings, but to do so we must use a different character: the backtick. It points toward the right, while the apostrophe On US keyboards, it is usually on the same key as the tilde. >>> y + " " + 'world' + `x` 'hello world9' >>> This may be a reasonable stopping point – the attention to detail required for success throughout these examples may take some effort for attendees, especially if you have some who do not have experience with algebra. Pack up the Pi kits as normal.