Download presentation
Presentation is loading. Please wait.
1
1-1 The Python IDE
2
What is Python? Python is a high level programming language.
A programming language is a way of giving instructions to a computer. A computer can only do one thing at a time. Because of this we need to write our instruction in a sequence. With each instruction being carried out on a new line. All of these instruction together form an algorithm. Python is an interpreted language. Python can operate in two modes, namely interactive mode and script mode. We typically use the interactive mode to test and debug small amounts of code, and the script mode for running larger projects.
3
A sequence of instructions
A computer can only perform one instruction at a time. Therefore we must write code in a sequence. The order in which we write the instructions is very important.
4
Algorithm An algorithm is simply a sequence of instructions to solve a specific problem. Have a go…. On your whiteboards write an algorithm that solves the following problem…. + Make a cup of tea
5
Low level languages When electronic computers where first used all programs has to be written in machine code (low level). To produce code programmers had to write code out using binary instructions. These binary instructions tell the CPU what to do ( ) This takes ages and is very prone to errors. Large teams of people had to be both write the algorithm as well as program the computer but changing the states of many switches. Mathematicians where the only people who could write computer code
6
Colossus (Bletchley park) Manchester Baby
Imagine how complex it would be to program this computer using wires and connectors to tell the computer what to do in machine code ( ) [insert video]
7
High level languages If we had to write all computer programs in machine code (low level) we would not use computers in the same way that we do today. If it where code would only be written by high level mathematicians at research institutions. High level languages where invented to allow us to code using human based language. As computers cannot understand anything but binary translators are used to convert high level languages into low level language that the computer will understand.
8
Comparison – High to low
9
Compilers and Translators
[insert video]
10
Translator A translator will convert only one line of code at a time. After it converts each line it sends it straight to the CPU (the “brain” of the computer) – NOTE- the CPU is nothing like a brain and you should refer to it as a brain but it helps make this point - Translators run slow as the interpreter is constantly working between your code and the CPU + Translators generally working on multiply platforms (MAC/Windows/Android/IOS) as the translator will translate for the CPU that is present + Translators let us debug the code as we can watch the code run line by line and see where an error might occur
11
Stepping Stepping is simply the process where computer code is run line by line. Between each line the program stops and the programmer can study the output. Have a go Write the code below in Python visualizer that will display the following on the screen sName = “Mr Gildroy” iAge = 30 Print(“Your name is – “ + sName) Print(“your age is – “ + iAge)
12
Compiler A compiler converts all off the high level code into machine code before it is run. The CPU can run the machine (or binary) code directly and does not need any interaction with a translator. + Compiled code is much much quicker - Compiled code is specific to a platform. It generally does not work across different
13
Debugging Vs Programming
To add
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.