Menu
Home Page

Computing

Computer Science
Introducing Python
LC:  Navigate Trinket (create, save, run programs)
Understand and use mathematical operation and ‘print’
statement.


Vocabulary: Python, scripting language, visual programming language, syntax, compiler.

 

We will be using a language called Python to write programs. We have had prior experience of writing programs using Scratch, which is a visual programming language as we built up programs by visually dragging programming blocks. Python is a scripting language, so instead of dragging blocks we have to write code and we have to learn the language of Python’s code (called the syntax) - just like we may learn languages such as French of Urdu.

In Python we can complete mathematical calculations, look at the Python code for different mathematical operators.

 

We shall now open a compiler and write our first Python code, we shall use Python to complete the calculations below.

300+400

987-653

12*9
30/6

 

The syntax to program for calculation in Python is

print(5+4)

 

 

We are now going to output text within Python. Instead of using brackets we use quotations to display text, look at the example below:

print”Hello World!”

 

What do you think will be displayed when we run our code?

Have a go at displaying text using Python coding.

Coding Challenge: Now write a program which displays more lengthily text on different lines? For example:
Hello, how are you today?
I hope you are enjoying learning Python.
What shall we code next?

 

Once you have successfully created and run your code upload a screen shot into schoolwork.

Top