top of page

Search CSNewbs

286 items found for ""

  • Python | 4b - Mathematical Operators | CSNewbs

    top Python 4b - Mathematical Operators Modulo Division The modulo operator - the percentage symbol % - will work out the remainder left over when one value is divided by another. print (30 % 6) = 0 30 ÷ 6 = 5, which is a whole number, so there is no remainder and 0 is output . print (30 % 7) = 2 30 ÷ 7 = 4 remainder 2 ; so the remainder is output . You can use modulo with variables too: num1 = 33 num2 = 4 print ( "The remainder is" , num1 % num2) The remainder is 1 = A common use of modulo is to check if a number is odd or even . If a number has no remainder when divided by 2 then it is even . = num = int ( input ( "Enter a number: " )) if num % 2 == 0: print (num, "is even." ) else : print (num , "is odd." ) Enter a number: 400 400 is even. Enter a number: 191 191 is odd. = Modulo Div i sion Task 1 ( Remainder) Ask the user to input a whole number . ​ Use the modulo operator ( % ) to check if there is a remainder when the user's number is divided by 5 . Print the re mainder. Example solution: Enter a number: 123 The remainder when divided by 5 is 3 Modulo Div i sion Task 2 ( Rollercoaster) Use the odd/even program above to help solve this problem: ​ A rollercoaster only lets people on in groups of 4 . ​ Ask the user to input a number for how many people are in their group. Check if that number is directly divisible by 4 using modulo division ( % ). If it is then print “Perfect groups of four!” Else print “You will be split up” . Example solutions: Welcome to the Hyper Coaster! How many in your group? 6 You will be split up! Welcome to the Hyper Coaster! How many in your group? 12 Perfect groups of four! Integer Division Integer division removes any decimal numbers when performing division , leaving just the integer (whole number ). ​ In Python integer division is performed using // . print (20 / 3) print (20 // 3) = 6.666666666666667 6 Integer Div i sion Task 1 ( Integer Division by 5 ) Use an input line with int to ask the user to enter a number . ​ Use integer division ( // ) to divide the number by 5 without keeping any decimal values . ​ Challenge: Improve your solution by altering the print line to be more user friendly . Example solutions: Enter a number: 27 5 Enter a number: 27 5 goes into 27 5 times. Integer Div i sion Task 2 ( Plane Rows) A large plane has 6 seats in row. ​ Input the number of passengers on the plane and use integer division to work out how many full rows will be filled. Example solution: How many passengers are there in total? 174 There will be 29 full rows on the plane. Exponent (Powers) An exponent is the number of times a value is multiplied by itself , for example 2 = 2 x 2 x 2 = 8 . The symbol to represent an exponent in Python is ** . For example: 4**2 represents 4 which is also 4 x 4 . 3 2 print (4**4) = 256 base = 5 exponent = 4 print (base**exponent) 625 = Exponent Task 1 ( Square Number) Use an input line with int to ask the user to enter a number . ​ Output the square of this number. Example solution: Enter a number: 12 12 squared is 144 Exponent Task 2 ( Custom Exponent) Use an input line with int to ask the user to enter a number, this will be the base . Make another input line with int to ask for the exponent . ​ Use ** between the base and the exponent and print it. ​ Challenge: Make your solution better by including the base and exponent in the print line. Example solutions: Enter the base: 7 Enter the exponent: 3 343 Enter the base: 7 Enter the exponent: 3 7 to the power of 3 is 343 ⬅ 4a - If Statements 4 c - Log ical Operators ➡

  • Python | 7b - Functions | CSNewbs

    top Python 7b - Functions What is a Function? A function is a subroutine that takes one or more values from the main program and returns a value back. For example, transferring over a sphere’s radius from the main program for the function to calculate a surface area and then return that value to the main program. The two key differences between procedures and functions are: A function uses parameters to transfer data from the main program into the function. A function returns a value to the main program. Writing Functions A function is written the same way as a procedure but it uses parameters . In the example below the parameters are num1 and num2 which are sent from the main program to be used in the function . The return command is used to send a value back to the main program . Below is another example of a function that takes the radius of a sphere and works out the area in a separate function . ​ The area is returned to the main program and printed. Subroutines can be reused and called with different parameters . ​ The program below repeatedly takes an integer input and adds it to a total in a function that is then returned and printed. Practice Task Create a program similar to the sphere example above, this time to work out the volume of a cylinder. ​ In the main program ask the user to enter the cylinder's radius and then its height. ​ The actual calculation should be done in a function and returned to the main program. ​ The calculation for a cylinder's volume is: ​ pi x (radius x radius) x height ​ Extension: Use the round command from section 9b to round the number to 2 decimal places. Example solution: Using Subroutines as a Menu Subroutines are often used to split programs up and give users a selection of options . ​ Subroutines are used for this purpose because they are separate , making it easier to code and manage a program . ​ The example below for a simplified online banking system uses separate subroutines accessible within a while true loop . ​ Depending on the option chosen by the user, the appropriate subroutine will be called . Instead of a further practice task here, Task 4 of the Section 7 Practice tasks page challenges you to make a similar program using multiple subroutines. ⬅ 7a - Proced ures Section 7 Practice Tasks ➡

  • 3.2a - Databases & Normalisation | OCR A-Level | CSNewbs

    Exam Board: OCR 3.2a - Databases & Normalisation Specification: A-Level 2015 An instruction set is a list of all the instructions that a CPU can process as part of the FDE cycle . ​ CPUs can have different sets of instructions that they can perform based on their function. The two most common instruction sets are the simpler RISC (Reduced Instruction Set Computer ) and more complicated CISC (Complex Instruction Set Computer ). Instruction Sets This page is still being updated. Graphical Processing Unit What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Q uesto's Q uestions 3.2a - Databases & Normalisation: ​ 1. What is cache memory ? [ 2 ] ​ 3.1b - Encryption & Hashing Theory Topics 3.2b - SQL

  • 4.2 - Signed Binary - Eduqas GCSE (2020 Spec) | CSNewbs

    4.2: Signed Binary Exam Board: Eduqas / WJEC Specification: 2020 + What are Sign and Magnitude and Two's Complement? Sign and Magnitude and Two's Complement are both methods of writing positive and negative binary values . ​ Sign and Magnitude is simpler but will cause incorrect answers if used in binary calculations . ​ Two's Complement is more complex but will generate correct answers when used in binary calculations . Sign & Magnitude The most significant bit (MSB ) is the largest bit of a binary number - the one furthest to the left . The MSB is the sign - it represents whether the binary value is positive or negative . ​ If the sign is 0 then the binary number is positive . ​ If the sign is 1 then the binary number is negative . The other bits represent the magnitude - the value of the binary number. ​ For an 8-bit binary number , the range is -127 to 127 , because only 7 bits are used to define the magnitude. Sign & Magnitude: Problems Sign and magnitude is not commonly used by computers for two main reasons:​ Performing binary addition and subtraction (see section 4.3 ) will often cause a wrong result . In the example below, -7 + 3 should equal -4 but the result given is 2. + Sign and magnitude creates two different values for 0 - positive 0 and negative 0 which is incorrect. Two's Complement Two's complement is a method of representing positive and negative binary values. It is used often by computers because binary calculations will work correctly and there is only one value for zero. Two's Complement: Denary to Binary To represent a negative value using two's complement follow these steps: ​ Write out the positive value in binary . Start on the right-hand side and move along, copy all 0s until you get to the first 1 . The first 1 is copied too. After the first 1 invert each value (change to its opposite ). So 0 becomes 1 and 1 becomes 0 . 1. 2. 3. Two's Complement: Binary to Denary To convert a binary number to denary using two's complement you must remember that the MSB is a negative value . ​ Just add the numbers with 1 together to work out the denary value . Q uesto's Q uestions 4.2 - Signed Binary: ​ Sign & Magnitude 1. Using sign and magnitude , convert the following values to denary : a. 00011101 b. 11100011 c. 10110110 d. 01001111 [1 each ] ​ 2. Using sign and magnitude , convert the following values to binary : a. 83 b. -13 c. -102 d. -24 [1 each ] ​ 3. Describe two problems when using sign and magnitude . [ 4 ] ​ 4. Using sign and magnitude , the range of numbers that can be represented in 6 bits is from - 31 to + 31 . State the range of numbers that can be represented using sign and magnitude in the following bits: a. 8 bits b. 4 bits [1 each ] ​ Two's Complement 1. Using two's complement , convert the following values to binary : a. -20 b. -49 c. -87 d. -113 [2 each ] ​ 2. Using two's complement , convert the following values to denary : a. 10110010 b. 11101110 c. 01101011 d. 10011111 [2 each ] Watch the video to learn how sign and magnitude is used to represent negative numbers in binary . Watch the video to learn how two's complement is used to represent negative numbers in binary . Watch on YouTube Watch on YouTube 4.1 - Number Systems Theory Topics 4.3 - Binary Calculations

  • 6.2 - Utility Software - Eduqas GCSE (2020 Spec) | CSNewbs

    6.2: Utility Software Exam Board: Eduqas / WJEC Specification: 2020 + What is utility software? Utility software are dedicated programs used for the maintenance and organisation of a computer system. Antivirus Antivirus software is used to locate and delete viruses on a computer system. The antivirus scans each file on the computer and compares it against a database of known viruses . Files with similar features to viruses in the database are identified and deleted . Firewall A firewall manages incoming and outgoing network traffic . Each data packet is processed to check whether it should be given access to the network by examining the source and destination address . ​ Unexpected data packets will be filtered out and not accepted to the network. Disk Defragmenter As files are edited over time they will become fragmented - this is when the file is split into parts that are stored in different locations on the hard disk drive . Files that are fragmented take longer to load and read because of the distance between the fragments of the file. Defragmentation software is used to rearrange the file on the hard disk drive so that all parts are together again in order. Defragmentation improves the speed of accessing data on the hard disk drive. Backup Software System backup copies data onto a separate storage device in case the original information is lost or corrupted . ​ Backups should be saved regularly and stored in a different location to the rest of the data. Magnetic tape is a common backup medium. ​ A typical backup policy is one known as 'grandfather - father - son' which uses three different backups at a time. Disk Compression Compression is the process of decreasing the size of a file . Disk compression is a utility tool that automatically compresses files when saved so that more data can be stored on the hard disk drive. When a file is to be opened, the program is automatically decompressed . Disk compression increases the amount of space on a hard disk drive but it takes longer to open and close files . Disk Checker ​ This utility is used to scan a hard drive for any corrupted data . ​ The corrupted data is deleted to speed up reading from and writing to the hard drive. ​ More advanced disk checkers are used to scan for bad sectors . A bad sector is a permanently damaged section of the hard drive which can no longer be used and must be skipped over. Disk Formatter Disk Partition Editor This utility tool prepares a storage device such as the hard disk drive to be used by removing the current data and creating a file system . A file system manages how data is stored and accessed . ​ Other devices like a USB stick may need to be formatted before they can be used for the first time . Within memory, partitions are segments of data that have been grouped together logically on the hard disk drive . ​ A disk partition editor allows a user to view and modify these memory partitions . Options include creating, editing and deleting partitions. Clipboard Manager The clipboard is a temporary storage space for copied data. For example, a large amount of text can be copied and stored on the clipboard to be pasted into another document, even when the original file has been closed . ​ The clipboard manager adds more functionality to the clipboard to allow multiple pieces of data to be copied, cut and pasted . System Profiles A system profiler displays detailed information about the applications on a computer system, as well as data about any attached hardware devices . ​ Information is provided and updated in real-time about the performance of software and internal components such as the CPU . Data Recovery Data recovery tools allow deleted, corrupted or otherwise inaccessible data to be returned to a usable state . ​ The data loss may have been caused by physical damage to a drive, corrupt memory partitions or accidental deletion . ​ Most data is not permanently removed when it is deleted so data recovery software can often be used to reaccess files . Revision Control Revision control software manages previous versions of an application so that if an error occurs the program can be returned to a previous state . ​ This is also called version control software and can be used to manage and monitor changes made to files over time. Archiver Archiving is the process of storing important data that is not currently required . It must not be deleted but it shouldn't take up valuable storage space either. ​ An archiver compresses multiple files using lossless compression into one folder . This archived folder can be stored on a computer system or transferred to a storage device and won't take up much space . Cryptographic Utilities A cryptographic utility is used to encrypt data so that it cannot be understood if intercepted . Encryption is commonly for data in transit - being sent between devices . ​ Cryptographic software can also encrypt data at rest - when stored on a hard disk drive for example - so that hackers would be unable to use the data . File Manager This utility tool provides an interface to the user for accessing, editing and moving files and folders on the system. ​ Programs will be displayed in a hierarchical ( ordered ) structure with icons representing the application logo or file type. ​ Files can be ordered in alphabetical, chronological or other orders and the manager provides an abstracted visualisation of where the data is stored. Q uesto's Q uestions 6.2 - Utility Software: ​ 1. What is meant by utility software ? [1 ] ​ 2. Describe each type of utility software : a. Antivirus b . Firewall c . Disk Defragmenter d . Backup Software e . Disk Compression f . Disk Checker g . Disk Formatter h . Disk Partition Editor i . Clipboard Manager j . System Profiles k . Data Recovery l . Revision Control m . Archiver n . Cryptographic Utilities o . File Manager [2 ] 6.1 - Operating Systems Theory Topics 7.1 - Language Levels

  • Python | Extended Task 3 | CSNewbs

    Extended Task 3 Hi, Susanna here, ​ I want to make a blackjack-like program that I can play for fun at home in between revising for Computer Science. ​ The aim of my blackjack game is to get as close to 21 as possible with the most number of cards, without going over. ​ So... The user can choose whether to be hit with a new card (a number between 1 and 8) or fold and stop. Each number they are dealt adds up to their total . If the total goes over 21, then they lose .​ If they bust (when over 21) or folded then their final number and their number of cards is displayed . Blackjack For this task, you will need to create a document and include the following sections (with screenshots where appropriate): ​ An introduction to explain the Purpose of your program . A List of Requirements for a successful program. Screenshots of your code (with comments in your code to show understanding). Testing – Create a plan to show how you will test your program and then explanations of any errors that you found and how they were fixed . An Evaluation of what worked, what didn’t, and how you met each of your requirements from your original list. Also, discuss further improvements that you could have made to improve your program. Example solution: Helpful reminders for this task: Think about the type of loop that you need. Will you need more than one loop? What variables will you need? Remember to use an input . What will you ask the user? How will you use their response? Remember to use ‘import random’ and randint to create a random number . What outputs do you need and when? What should you display… After each hand? At the beginning? At the end? ⬅ Extended Task 2 (Lottery) Extended Task 4 (Vet Surgery) ➡

  • Python | Extended Task 4 | CSNewbs

    Extended Task 4 Hi, Jacob Mortimer here from Cats & Dogs Veterinary Surgery . ​ There was a flood last week, and our computer systems were totally destroyed . ​ I need you to create a program , using a file , that allows my receptionist to: ​ Add new animals to the file . Search through the file and print the details of a specific animal . Allow a specific animal to be removed from the file . Vet Surgery For this task, you will need to create a document and include the following sections (with screenshots where appropriate): ​ An introduction to explain the Purpose of your program . A List of Requirements for a successful program. Screenshots of your code (with comments in your code to show understanding). Testing – Create a plan to show how you will test your program and then explanations of any errors that you found and how they were fixed . An Evaluation of what worked, what didn’t, and how you met each of your requirements from your original list. Also, discuss further improvements that you could have made to improve your program. Reminders for this task: You will need to create a selection of options for the user to choose from. Subroutines and a while true loop may help. Section 10 will help you to open, write and read from files . Section 10c shows how to edit data in a file. You will need to adapt this code and not write the line that has been selected, instead of writing a modified version of it. There are multiple ways to approach this program, and your solution might look different from the example. Break the problem down and focus on one part at a time. Example solution: Entering 1 allows the user to enter the details of a new animal which is saved into the file . ​ Entering 4 will stop the loop and ends the program. Entering 2 allows the user to enter the details of an animal to search for . If the animal is in the file, their details are printed clearly on a new line. Entering 3 allows the user to enter the details of an animal to remove from the file . If the animal is in the file, all lines are transferred into a temporary file except for the line to be removed . ⬅ Extended Task 3 (Blackjack) Extended Task 5 (Colour Collection) ➡

  • HTML Guide 3 - Text Tags | CSNewbs

    3. Tags for Text HTML Guide Watch on YouTube: Remember to write the tags for everything you want the user to see between the and tags. Headings Time to add text to your web page such as headings and paragraphs. To write a large heading , use and ​ To write headings in a smaller size, use numbers between 1 and 6. Add a large heading and a sub-heading to your webpage. paragraph Paragraphs Typing text between the and tags will create a paragraph . Add at least three different paragraphs to your webpage. bold underline italics Bold, Underline & Italics You can format your text by changing it to be bold , underlined or italicised (slanted). Now you have text on your web page, you can add hyperlinks to take viewers to different websites. In the paragraphs you have already written, add at least 1 bold tag, 1 underline tag and 1 italics tag. 2. Essential Tags HTML Guide 4. Hyperlinks

  • Python | 1c - Creating Variables | CSNewbs

    top Python 1c - Creating Variables What is a Variable? A variable represents a value that can change as a program is running . The two parts of a variable are the name (e.g. sweets) and the value (e.g. 8). sweets = 8 ​ print (sweets) = 8 amount of sweets = 8 ​ 8sweets = 8 sweets A variable can't contain spaces , it must start with a letter , and you must declare its value before you can use or print it. You always need to print the variable name (e.g. biscuits), not the value (20) as the value can change. Important – When writing variable names, we do not need speech marks. (e.g. type biscuits , not “biscuits”) ​ We use variables because the value of something might change as the program is executed. For example, if someone eats a sweet then the value of our variable changes: sweets = 8 ​ print (sweets) ​ sweets = 7 print (sweets) = 8 7 sweets = 8 ​ print ( Sweets) You must be consistent with capital letters when writing variable names. ​ sweets and Sweets are treated as two different variables. Creating Variables Task 1 ( Age & Pets) Make a variable named age and set it to your current age. On the next line print age . ​ Make another variable named pets and set it to how many pets you have. On the next line print pets . Example solution: 14 2 Variables with Strings (Text) In programming, a collection of alphanumeric characters (letters, numbers and punctuation) is called a string . "Pikachu" is a string. ​ In the example below, pokemon is the variable name that represents the variable value "Pikachu" . pokemon = "Pikachu" ​ print (pokemon) = Pikachu To create a string, we use "speech marks" . Numbers by themselves and variable names do not use speech marks. Each variable can only have one value at a time, but it can change throughout the program. pokemon = "Pikachu" ​ print (pokemon) ​ pokemon = "Squirtle" ​ print (pokemon) = Pikachu Squirtle Creating Variables Task 2 ( Superhero & Colour ) Make a variable named superhero and set it to any of your choice, such as "Spider-Man" . Print the superhero variable on the next line. ​ Make another variable named colour and set it to the colour related to your chosen superhero. Print the colour variable on the next line. Example solutions: Spider-Man Red The Hulk Green ⬅ 1b - Co mmenting 1d - Using Variables ➡

  • 2.4b - Assembly Language | OCR A-Level | CSNewbs

    Exam Board: OCR 2.4b: Assembly Language Specification: A-Level 2015 An instruction set is a list of all the instructions that a CPU can process as part of the FDE cycle . ​ CPUs can have different sets of instructions that they can perform based on their function. The two most common instruction sets are the simpler RISC (Reduced Instruction Set Computer ) and more complicated CISC (Complex Instruction Set Computer ). Instruction Sets This page is still being updated. Graphical Processing Unit What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? ​ Cache memory is temporary storage for frequently accessed data . ​ Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Q uesto's Q uestions 2.4b - Assembly Language: ​ 1. What is cache memory ? [ 2 ] ​ 2.4a - Programming & Pseudocode Theory Topics 2.4c - Object-Oriented Language

  • Key Stage 3 | CSNewbs

    Key Stage 3 Topics Hardware Python Basics 1. Motherboard 2. The CPU 3. Memory 4. Expansion Cards 1. The Basics 2. Variables 3. Inputs 4. Calculations 5. Selection 6. Turtle 7. Link to GCSE Python Cyber Security 1. Malware 2. Phishing & Staying Safe Desktop Publishing (DTP) Desktop Publishing

  • 8.4 - Validation & Verification - Eduqas GCSE (2020 Spec) | CSNewbs

    8.5: Validation & Verification Exam Board: Eduqas / WJEC Specification: 2020 + What are validation and verification checks? Validation is a process to check that data is reasonable or sensible before it is accepted . ​ Verification is the process of checking that data is correct after it has been entered. Validation Checks Range Check Checks data is within a certain range . Age: 34 203 Type Check Checks data is a certain data type . Height (in cm): 182 Two metres Format Check Checks data is entered in a certain way . Date of Birth (DD/MM/YYYY) 25/03/2001 25th March 01 Presence Check Checks that data has actually been entered and not left blank . Password: fluffythecat123 Lookup Table A table of acceptable entries , also known as a list . Length Check Checks the length of the input is within a certain amount. Telephone Number 08323877319 07383 Verification Checks Double Entry Typing in the data twice to make sure there were no spelling errors the first time. Password: fluffythecat123 flufythecat123 Proofreading Checking two copies of data to ensure they are exactly the same . Check Digit Similar to a checksum in a data packet, a check digit is calculated on barcodes to ensure the rest of the numbers are correct . Address: 11 Cherry Lane 11 Cherry Road Confirm Q uesto's Q uestions 8.4 - Validation & Verification: ​ 1. Describe each type of validation check and give an example . a. Range Check [ 3 ] b. Type Check [ 3 ] c. Format Check [ 3 ] d. Presence Check [ 3 ] e. Lookup Table (List) [ 3 ] f. Length Check [ 3 ] ​ 2. For the following data, suggest which validation check would be most suitable and why : a. Password [ 3 ] b. Country of Birth [ 3 ] c. Number of Tickets [ 3 ] d. Weight (in kilograms) [ 3 ] ​ 3. Describe three types of verification check and give an example : a. Double Entry [ 3 ] b. Proofreading [ 3 ] c. Check Digit [ 2 ] 8.4 - Sorting & Searching Theory Topics 9.1 - IDE Tools

bottom of page