Lesson 1: Introduction to Python, sequence, variables, Alan Turing, Chatbot creation and more ...

Download student powerpoint

Head to the main page to check out our other popular resources: Challenges | Solve and Learn | How-to

Sign up for free and purchase a subscription to access any paid downloads available (£50.00), including power points and task files.




 Sign up - Free to download the powerpoint and associated files.


What you will cover

An introduction to Python 3, including how to download/install. We introduce variables, sequences, programs, Artificial Intelligence and Alan Turing. The lesson also covers an introduction to the language. You will dive straight in and create your own Chat Bot. Introducing variables, sequence, programs, Alan Turing and Artificial Intelligence. Big ideas to discuss: DNA Coding and Intelligent design. Create apps which include the use of random number and item generation. Suggested videos on ‘Introducing Python’ and History of Computing. Learn about Mathematical and comparison operators, variables, strings and things and the importance of indentation in Python. Includes suggested videos, ‘Big ideas’ discussion, and HW/research projects section.

Additional material for this lesson

Description: File:brainandmemory



Memory is a curious thing. It isn't fully understood. Just stop and think for a moment - your brain is essentially a lump of flesh. How does a lump of flesh REMEMBER? If I told you now (as you read off the screen) that I am 33 years old, you would REMEMBER the number 33 or rather your brain - that lump of flesh - somehow stores the value. How old am I? That's right - your lump of flesh remembered!

How does a Computer remember?

Remember a computer is just a bunch of circuits. Circuits that can be turned ON and OFF. That’s where the genius of Binary comes in, but you’ll have to navigate to www.teachingcomputing.com for that topic. Programming langauges aren’t quite dealing with memory at a low level, but all you really need to know is that they use things called Variables to store values and data. A variable as the name suggests, is changeable so can be altered while the program is running. In Python, declaring a variable is super easy. Decide what you want to store, decide what you want to call your variable, and then give it a starting value!

Storing Values - Data Types

The data stored in memory can be of many types. Remembering my age -33 – is a numeric value. You may also want to remember your grandmother’s address, and that would be stored as alphanumeric characters. Python has various standard data types that are used to define the operations possible on them and the storage method for each of them. For now, just keep the following in mind: Numbers, Strings, List, Tuple, Dictionary. It won’t be long before you know what each of these things are and are using them like a pro!

Declaring and Using variables

Just to demonstrate, here’s an example of using the python IDLE to create a couple of variables, change their values, and then finally print the value of of z, which is the sum of the first two variables. Nothing terribly complicated yet, but it’s a start. Without variables and values that are stored in a program, you wouldn’t get very far. So, if you haven’t already, make sure you have downloaded Python 3, and try it yourself in the IDLE.

Declaring numeric variables in Python
 
>>> x=2
>>> x=4
>>> x=3
>>> y=5
>>> z=x+y
>>> print(z)
8
>>> 

Next, we’re going to get right into creating a chatbot, which will demonstrate the use of variables and their function. It’s really very cool and simple enough for you to create as your first program! Before we do that, just play around on the IDLE for a bit. Use the example shown below, and then declare other variables and see what happens! You'll notice that you can in fact appear to "add" strings using the same "+" operator. This isn't called adding though - it's called CONCATENATION (as a computer scientist your vocabulary is going to explode!) and it just bangs two strings together.

Declaring string variables in Python and doing something cool - Concatenation!
 
>>> name="mr"
>>> lastname="moose"
>>> wholename=name+lastname
>>> print(wholename)
mrmoose
>>> 

Description: Fie:variables



But now, back to that lump of flesh ...

***Did you know that studying the brain has led to several revolutionary advancements in computational theory? The brain is a wonderful organ …wait, that really is an understatement. The brain is unsurpassed in what it does. Have scientists come close to creating a robot that has a brain like ours? Gosh, not even close. As in….not AT ALL close. So, the question is – is the brain a mere machine? Philosophers through the ages have asked themselves this very question and you may want to check out John Von Neumann’s “The Comptuer and the Brain(1958). Read the stuff he wrote about here! Is the brain a machine like a computer? Now, don’t take his word for it. You’ve got to come to your own conclusions about things like this! Even if the brain was like a machine – what does that say about life and evolution? Is it really possible that the brain evolved by random chance? Perhaps, you might say, especially if one had billions of years to play with …but the billions of years may actually create more of a problem in terms of the evolution of such an incredibly complex organ. Would you believe it if someone told you a fully functional computer had been found in a cave in Africa and it had almost certainly evolved, without any intelligent design or ‘designer’ behind it, all on its own? What do you think?





Your one stop for all things Python. Do look around!


What's included?
Our highly popular lessons series - content added regularly! Don't forget to also check out the "Solve & Learn Online" section which includes hugely popular lessons, challenges, tutorials, presentations, step by step guides and more. If you can't quite find what you need, do check out our very useful and growing library of all possible python Code Snippets
Series 1: includes variables, sequence, selection, iteration, and functions, not to mention a load of interesting computing trivia and theory embedded in each ppt, along with learning objectives, quizzes, challenges, solution .py files, tasks and suggested hw, discussion topics and research
Series 2: covers everything from functions to, lists, list operations, list comprehension, tuples, sets, dictionaries, file handling, read and write from file, including working with CSV files, creating a facebook like application (teacherbook!), using file read and write/append techniques. All lessons include practical tasks, challenges and solution files can be found in 'code snippets' (on this site) or downloaded from the drive:
Series 3: introduces the concept of object orientated programming and the use of classes with Python. Learn how to create your own classes (and objects) from scratch, and understand OOP essentials. Download pygame and create games in pygame, step by step tutorials. Create a class based game in python and pygame. Understand some of the principles behind game design in programming including edge detection and collision detection. Explore and understand the algorithms and maths behind these important game design essentials. Collision detection in Python and Edge detection, boundary detection. A look at class diagrams and UML for design.
Game Design Series -highly recommended as described above and create a platform game in Pygame
GUI Python with Tkinter
Content regularly added
Subscribe for access to the drive