Assignment, Variables, Constants & Sequences
Inputs, Outputs & Type Conversion
Condition controlled Loops
Count Controlled loops
Nested Selection and Iteration
Subroutines 1 - Procedures
Subroutines 2 - Functions
Operators and Operations
Structured Programming
Validation and verification
Open a Cornell notes sheet by clicking on the image below.
Remember good notes allow students to help each other problem solve
Good notes will help you organise and process data and information
Cornell notes help you retain and recall information by having three different ways/sections where you process the information.
Note taking is a way of helping you to remember things you would otherwise forget. It also stimulates our critical thinking skills.
Remember! whenever you see the notes icon this means the information is important and you should write it down on your notes sheet.
In python we use built in functions to help us with our input and output. The function we use to output to the screen is print() and the function we use to get input from the keyboard is input().
Let us look at the the output method print() first.
...In order to display text output in python you need to surround your message in quotation marks. The print function also needs your output to be surrounded with brackets.
...Any line of code that starts with a # is a comment: it doesn’t affect how the program runs, it’s just there to help explain what the code does.
Your code won’t run at all until you’ve fixed all of the errors: You need to fix all the lines of code even before the first line will run.
Python is case sensitive: be careful with CAPITAL LETTERS and lowercase letters
Sometimes when your program does not work it is often the case that you have made a syntax error. Syntax errors are typographical mistakes that the programmer has made. When the code get translated for the computer to understand you will get an error message. Sometimes the message is useful, sometimes it is not!
When you are writing programs especially as they get more complex it is very difficult to not to make syntax errors (i do it all the time), so it is good to be able to understand the error messages so you can fix it yourself. As you get more experienced you will learn to interpret the error messages more easily and quickly.
Copy the code below into a new python file and save it as "debugging"
Try and fix all the errors so that the code works
print("Hello Everyone) print("This is a poem") print(Once there was a little boy,) print(With curly hair and pleasant eye—") Print("A boy who always told the truth,") print(And never, never told a lie.") Print("And when he trotted off to school,") pint("The children all about would cry,") PRINT("There goes the curly-headed boy—") print(The "boy that never tells a lie.")
Add #comments at the end of each line where there is an error, stating what type of error it was.
In python if you want the user to input data into the program, you can use the input()function, this is another built in functions to help us put data into our program.
Let us now look at the the input method input().
...In order to get user input in python you need to use the input() function. This puts a prompt onto the screen to allow the user to enter data. If you want to use the data in your program you have to store it in a variable . The print function can then use the variable to output our user input to the screen .
...If we want to use numbers in our code we have to change the user input to the data type of the number we want to use. For example if the type of number we want to use is a whole number then we convert the input using the int() function. However if the type of number we want to use was a decimal number then we convert the input using the float() function.
Lets look at the learning outcomes and decide which one best describes our current level of understanding :
Tick the one you feel is closest to your level
AQA Computer Science Tutor
Input Output
Python Syntax
Algorithms
ASCII Art