Please complete Task 1 (p5) and Task 2 (p7) for Monday.
For Task 2 you can use any design methodology, there is no need to create the actual program.
Please complete Task 1 (p5) and Task 2 (p7) for Monday.
Programmers need to make sure that the data they allow into their programs is sensible. They can use input validation to check that the data is within a range.
This is a programming statement which increases by a known amount, each time it is called.
Incrementing counters are often used inside loops to keep track of the number of iterations.
In the example above the tries=tries+1 line is keeping track of how many times the loop has been iterated.
Today we investigated the use of the if statement, this is a selection statement which allows Python to make choices.
We have updated our dice roll program from last time to include a for loop and multiple if statements. The program now displays a summary of the results of 1000 dice rolls.
For homework the class were asked to TRACS the program and we will discuss how efficient it is next time.
Today the class carried out an investigation into the JPEG image compression technique. The pupils were tasked with finding out.
The Pupils had to report on a powerpoint slide and include an example of a good and bad use of JPEG.
A function is a predefined block of code which is used then programming. It often contains a number of commands and steps.
Here are some of the functions we have met
This function displays the string that is contained in it parenthesis ().
print(‘Hi there, how are you?)
This function displays the string in its parenthesis but allows the user to enter a string that is then returned and assigned to a variable.
age=input(‘What is your age?’)
Converts the contents of its parenthesis to a string
check=input(‘Is your age ‘+str(age))
Outputs the length (number of characters) of a string or the size (number of elements) in an array
print(‘The length of your name is’,len(name))
Converts a value to a floating point number
weight=float(input(‘How many KG do you weight’))
Converts a value to an integer
age=int(input(‘What is your age?’))
Python input() function returns a string to the assigned variable. This can cause us problems when we want to store integers or floats.
We can use the int() function to convert the string to a integer or the float() function to convert it to a floating point. It is better to do this when you get the input or initialise the variable as you may forget later in the program.
This blog will now contain information about three levels of the Computing Science Course.
Today we recapped performing calculation within and using a loop. We started off redoing the 6 times table task, before improving it to display all the times tables from 1 to 10.
We then created a program that took in 4 ages and displayed the total only using one user created variable
These two programs make use of loops to reduce the number of programming lines, this making the program more efficient.
Today we started to use Dream weaver to create a website for a guitar company. We were given a brief and are following a set of note to achieve it.
The page we were working on today had a 3 column liquid layout, menu bar and will contain a graphic in the next lesson.