Please log into Glow and check inside MS Teams. If you do not have the “Higher Computing Science” team then email us at bict@coltnesshigh.n-lanark.sch.uk
Category: News
Free CyberFirst Adventurers – Booking Now
GCHQ Cyberfirst course – this is not a school course.
These short courses are designed to introduce 11-17 year olds to the world of cyber security.
CyberFirst Adventurers
A free 1 day non-residential course aimed at 11-14 year olds. The course consists of four themed modules offering interactive, hands on, self-guided, exploratory learning that reduces the amount of time spent in traditional instructor led presentations to the very minimum.
Check out all courses and locations at
- https://www.ncsc.gov.uk/information/cyberfirst-courses
N5 – Input Validation
Today we looked at the following problem
Write a program which will allow a user to input only a number in the range 0-100. An error message will be output if the number is invalid.
The program will output a message when the number input is valid (after the loop for checking the number).
We then worked through Analysis, Design, Implementation and Testing of the program.
Analysis
Input – a number
Process – check number is between 0 and 100
Output – a message about the numbers validity
Design
We looked at all three design methodologies and created designs in our jotter.
Pseudocode
- Declare Integer Number
- Get Number from user
- While Number < 0 OR Number > 100
- Display “Sorry that number is not valid”
- Get number from user
- End While
- Display “That is a valid number”
Flowchart
Structure Diagram
Implementation in Python
number=0 # declare number as type integer number = int(input("Please enter a number from 0 - 100 ")) while number < 0 or number > 100: print("Sorry that number is not valid") number = int(input("Please enter a number from 0 - 100 ")) print("That is a valid number")
Testing
We tested the code with Normal, Extreme and Exceptional test data.
Site Changes
I have now updated the course pages and categories to better organise the content of the site. This may mean that when you search for content that you need to check the categories to make sure it is up to date.
BGE – HTML Links
The anchor tag <a></a> in html 5 is used to create a hyperlink between two documents. The <a></a> surrounds text or an image that then is used to activate the link stored in the href attribute.
<!doctype html> <html> <head> <title> Page 1 </title> </head> <body> <h1>Page 1</h1> <p> This is a <a href="page2.html">link</a> to page 2 </p> </body> </html>
In the example above the word link is linked to page2.html.
School Closed – 28th February 2018
No School today due to the bad weather, stay home and stay warm.
Higher you will find a new revision question pack inside teams.
National 5 continue to access khanacademy for SQL, HTML & CSS.
N5 – Arrays (revision)
To read and write information to an array in Python we must first create the arrays, lines 4&5 do this for us.
The for loops on lines 8,12 & 17 are used to process each of the arrays in turn
- The for block for line 8 and 9 gets the 10 subjects and stores them in the subjects array.
- The for block on line 12 and 13 displays each subject name and stores the marks for that subject.
- Finally lines 16-20 display the information from each array in one table.
# get and display 10 subjects and marks # create two arrays to store the information subjects=[""]*10 marks =[0]*10 #Get all the subjects for index in range(10): subjects[index]=input("What is the name of subject" + str(index+1)) #Get all the marks for index in range(10): marks[index]=int(input("What is the mark for " + subjects[index])) #display subjects and marks print("-"*25) # Pretty divider for index in range(10): print(subjects[index],"\t",marks[index]) print("-"*25)
Test Post – Python Code
Using <pre />
print("Please enter your name") name = input() if name == "Bob": print("Hello " + name) else: print("Sorry only bob allowed " + name)
Using Plugin :)
print("Please enter your name") name = input() if name == "Bob": print("Hello " + name) else: print("Sorry only bob allowed " + name)
What line contains the conditional statement? You can see the answer below.
print("Please enter your name") name = input() if name == "Bob": print("Hello " + name) else: print("Sorry only bob allowed " + name)
Syndication
Posts from this blog will shortly be appearing on the Business ICT blog.
Welcome Back
A big welcome back to S4/5/6.