top of page

Search CSNewbs

286 items found for ""

  • Python | 10a - Open & Write to Files | CSNewbs

    Python 10a - Open & Write To Files Creating and Opening Files The "a" opens the file in append mode which will add new data to the end of the file. The open command is used to open files but it is also used to create new files . 'file' is just a variable and can be more relevant such as customer_file or whatever your file will be storing. Python looks in the same folder as your .py file and checks to see if Customers.txt already exists. ​ If it doesn't exist, it will create the file . The .txt extension will create a Notepad file. You can use alternatives such as .text or .docs. Writing to a File In the example below I ask the user to input a name which is written to the Names.txt file. ​ The .write command writes the contents of the brackets to the file . ​ You must close the file with the .close() command or the contents will not be saved . The .write command can be adapted depending on how you want the file to appear: Your text file won't update while it is open . ​ Close it and open it again to see any changes . ​ If you make any mistakes, just edit the file by hand and save it again. Practice Task 1 Create a new file called MyFriends.txt ​ Ask the user to enter 5 names. ​ Write the 5 names into a file. Place each name on a separate line. ​ Check the file to see if the names have been entered. Example solution: Writing Multiple Lines to a File Files are often used to store data about multiple people . ​ The program below asks for a customer's name, appointment date and VIP status then saves this information into a file. ​ The plus symbol is used to write information for a single customer on the same line . ​ This is beneficial if you want to search for a customer later. Practice Task 2 Create a new file called ALevels.txt ​ Ask the user to enter a student's name and their three A-Level subjects. ​ Write each student's information on the same line. Enter at least three different students and check your file to see it has worked. Example solution: ⬅ Section 9 Practice Tasks 10b - Read & Search Files ➡

  • 8.2 - Understanding Algorithms - Eduqas GCSE (2020 Spec) | CSNewbs

    8.2: Understanding Algorithms Exam Board: Eduqas / WJEC Specification: 2020 + What is an algorithm? An algorithm is a set of instructions , presented in a logical sequence . ​ In an exam you may be asked to read and understand an algorithm that has been written. To prove your understanding you may be asked to respond by actions such as listing the outputs of the algorithm, correcting errors or identifying an error within it. ​ Programmers create algorithm designs as a method of planning a program before writing any code. This helps them to consider the potential problems of the program and makes it easier to start creating source code. There are two main methods of defining algorithms : Defining Algorithms - Pseudocode & Flowcharts Pseudocode Pseudocode is not a specific programming language but a more general method of describing instructions . It should be unambiguous, and it should not resemble any particular kind of programming language (e.g. Python or Java), so it can theoretically be turned into working code in any language. ​ Generally, pseudocode can be written in any way that is readable and clearly shows its purpose. However, the Eduqas exam board advises that pseudocode for the programming exam should follow the conventions below : Annotation { Write your comment in curly brackets} ​ Define data type price is integer firstname is string ​ Declare a variable's value set price = 100 set firstname = "Marcella" ​ Input / output output "Please enter your first name" input firstname Selection (must have indentation) if firstname = "Steven" then​ output "Hello" + firstname elif firstname = "Steve" then output "Please use full name" else output "Who are you?" end if ​ Iteration (while loop) while firstname ! = "Steven" output "Guess my name." input firstname repeat Iteration (for loop) for i in range 10 input item next i ​ Define a subroutine Declare Sub1 [Subroutine content indented] End Sub1 ​ Call a subroutine call Sub1 Flowcharts A flowchart can be used to visually represent an algorithm. The flowchart symbols are: Algorithm Examples Below are two different methods for representing the same algorithm - a program to encourage people to buy items cheaply at a supermarket. The program allows the price of items in a supermarket to be entered until the total reaches 100. The total price and the number of items entered are tracked as the program loops. Once the total reaches 100 or more, an if statement checks how many items have been entered and a different message is printed if there are 20 or more items, 30 or more items or less than 20 items. Pseudocode Flowchart {This is a program to see how many items you can buy in a supermarket before you spend over £100} ​ total is integer, itemsentered is integer, itemprice is integer set total = 0 set itemsentered = 0 ​ while total < 100 output "enter the price of the next item" input itemprice total = total + itemprice itemsentered = itemsentered + 1 repeat if itemsentered >= 20 then output "You are on your way to saving money." elif itemsentered => 30 then output "You're a real money saver." else output "Look for better deals next time." end if Reading Algorithms In an exam you may be asked to read an algorithm and prove your understanding , most commonly by listing the outputs . ​ Start from the first line and follow the program line by line , recording the value of variables as you go . ​ When you encounter a for loop , repeat the indented code as many times as stated in the range . Example Algorithm: Start NewProgram ​ i is integer maxvalue is integer ​ input maxvalue ​ for i = 1 to maxvalue output (i * i) ??????? ​ output 'program finished' ​ End NewProgram Example Questions: 1. List the outputs produced by the algorithm if the 'maxvalue' input is 5 . ​ 2. State the code that has been replaced by '???????' and what the code's purpose is. Example Answers: 1. Outputs: 1 4 9 16 25 program finished 2. Missing Code: next i Purpose: Moves the loop to the next iteration. Watch on YouTube Q uesto's Q uestions 8.2 - Understanding Algorithms: ​ 1a. Read the algorithm shown on the left and list all outputs in the correct order if the inputs are 2 for height and 72 for weight . ​ 1b. Give the code that is missing from line 25 . 8.1 - Programming Principles Theory Topics 8.3 - Writing Algorithms

  • HTML Guide 1 - Setup | CSNewbs

    1. Setting up a HTML document HTML Guide Watch on YouTube: This guide assumes that you have Notepad++ already installed. ​ If you are working at home and need to download Notepad++ then click here . Save as .html file Notepad++ assumes you are writing a text file so you must change the file type . ​ Open Notepad++ ​ Click File then Save As... ​ Change Save as type: from Normal text file (.txt) to Hyper Text Markup Language file (.html) ​ Change File name: to Fanpage Website.html ​ These steps are necessary to set up your HTML web page correctly. Open Notepad ++ and save your file as a .html document. Editor vs. Browser View In newer versions of Notepad++ click on View then View Current File in and choose a browser installed on your computer such as Chrome . Some versions of Notepad++ enable you to view the document in a web browser by selecting Run then an option such as Launch in Chrome . It is good practice to have both Notepad++ and a web browser open at the same time so that you can easily check if any changes have been made correctly. ​ Remember to press the save icon ( ) before you refresh your browser . ​ Don't expect your web browser to show anything yet. Next it is time to add our essential tags for the structure of the web page. HTML Guide 2. Essential Tags

  • OCR CTech IT | Unit 1 | 4.1 - Communication Skills | CSNewbs

    4.1 - Communication Skills Exam Board: OCR Specification: 2016 - Unit 1 Communication skills are vital for anybody working within the IT industry. Employees will need to communicate with other members of their team and with those who encounter issues with their computer systems. Interpersonal Skills Communication is not just through speaking to another person, behaviour is also important. Employees should sit up straight in their chairs to show interest and eye contact should be maintained when speaking to another person or listening in a meeting. It is important to speak clearly so that others can understand what you are trying to say. Verbal Communication Employees should know when to use informal and formal language appropriately. For example, formal language should be used in meetings as it is a work environment . ​ Employees should think carefully about when to use technical terms . Technical terminology should be used when discussing issues with technicians but simplified explanations should be given to customers who may be inexperienced with their systems. Questioning Techniques Questioning is used to uncover problems in order to solve them . Closed questions will be direct and prompt a short, often one-word answer, such as "How many times have you tried to log in?". ​ Open questions don't have an obvious answer and may elicit an opinion , such as "Why are you using Internet Explorer instead of Google Chrome?". ​ Avoid leading questions - where you expect a certain response from the answerer, such as "Is the system always this slow?" Written Communication Again this form of communication can be formal - such as a letter to apply for a job - or informal - like sending a text or instant message to a team member. ​ There are a number of considerations to take before deciding whether communication should be formal or informal. For example, if the communication is between peers or external agencies (such as other companies or customers), any policies the organisation has in place and whether the communication will be legally recorded (such as saving all email correspondence). Barriers to Communication There are several reasons why a messages between people may be received incorrectly . ​ For example noise , language (not necessarily different languages but using technical terms) and physical barriers (i.e. learning difficulties or disabilities such as deafness). Another barrier is distraction - an email may be delayed because an employee is distracted by social media or other co-workers. Phones should also be turned off or to silent during meetings. Q uesto's Q uestions 4.1 - Communication Skills: 1. Describe 3 interpersonal actions that an employee should follow when speaking or listening to other team members. [ 3 ] 2. Explain when an employee should use technical terms and when they should simplify their explanations . [ 4 ] ​ 3. Describe the difference between closed , open and leading questions , giving an example of each. [6 ] ​ 4. Describe 3 things that should be considered when deciding between formal or informal written communication . [3 ] ​ 5. Describe 3 different barriers to successful communication . [3 ] 3.5 - Business Systems Topic List 4.2 - Communication Technology

  • 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 | CSNewbs

    When you see the checklist icon, complete the task in order to make your own HTML web page. HTML Guide 1. Setting up the web page 2. Essential tags 3. Text tags 4. Hyperlinks 5. Images 6. Organisation tags 7. Head tags 8. Videos 9. Colours & Fonts 10. More pages Watch on YouTube: These steps will show you how to make a HTML fanpage so get thinking of an appropriate topic - maybe your favourite book, movie or sports team? Download Notepad++ at home

  • HTML Guide 6 - Organisation | CSNewbs

    6. Organisation HTML Guide Watch on YouTube: This page explains the following tags which can be used to structure a simple page layout: ​​ Horizontal Line Centre Quote Bullet Points Numbered Points hr Horizontal Line You can add a horizontal line by simply adding to your document. ​ There is no close tag. Add at least one horizontal line to your web page. center Centre Align This tag places the content within the tags on the centre of the page . ​ Be careful - you need to use the American spelling - 'center ' - in your tags. Add tags to place your main heading in the centre of the page. blockquote Blockquote A blockquote is used to display a quote from another person or place. ​ Text is indented further from the margin than the other content. ​ It is not used very often, but can be found in some online articles and essays. Add at least one block quote to your web page. uo list Unordered List An unordered list is a set of bullet points . ​ The tag is placed before the bullet points and afterwards. ​ Each bullet point is placed within tags. That stands for list item . Add either an unordered or ordered list to your web page. Include at least three items in your list. o list Ordered List An ordered list will number each line . ​ The tag is placed before the list and afterwards. ​ Each list item is placed within tags. Add either an unordered or ordered list to your web page. Include at least three items in your list. Next it is time to add tags to the head, including a page title and metadata. 5. Images HTML Guide 7. Head Tags

  • 2.2 - Boolean Algebra - Eduqas GCSE (2020 spec) | CSNewbs

    2.2: Boolean Algebra Exam Board: Eduqas / WJEC Specification: 2020 + Boolean algebra is used to simplify Boolean expressions so that they are easier to understand. ​ Because calculations can use dozens of logical operators, they are simplified in Boolean Algebra using symbols rather than words. Take your time and don't panic. In an exam, you might get a list of identities (rules) to use. One tip to solving boolean algebra is to imagine that A and B are real expressions . In the examples on this page, imagine: A represents the true statement 'the sky is blue' B represents the true statement 'grass is green' ​ 0 always means FALSE 1 always means TRUE Boolean Symbols ​ A = NOT A A . B = A AND B A + B = A OR B Boolean Identities are the rules that are used to simplify Boolean expressions. ​ Each identity (law) has an AND form and an OR form , depending on whether AND or OR is being used . Commutative Law AND form: OR form: This law just switches the order of the expressions . For example, 'sky is blue' AND 'grass is green' makes logical sense in either order. Idempotent Law = AND form: OR form: This law removes repetition . Complement Law NOT AND form: The sky cannot be blue and not blue at the same time, so it must be 0 (FALSE). OR form: The sky is blue or not blue must be 1 (TRUE) as it has to be one of these options. Identity Law AND form: 1 represents TRUE . Both statements are true so it can be simplified as just A . OR form: 0 represents FALSE . Because A is true, you can ignore the false statement and it can be simplified as just A . Annulment Law AND form: 0 represents FALSE . Even though A is true, a statement cannot be true and false at the same time, so it must be 0 (FALSE). OR form: 1 represents TRUE . Both statements are true so this can be simplified as just 1 (TRUE). Absorption Law AND form: OR form: Absorption law reduces a bracket into one value. If the first A is true then both values in the brackets are true but if the first A is false then both values are false. Therefore this equation relies entirely on A and can be simplified as just A . Association Law ( ) AND form: OR form: This law separates a bracketed expression that uses the same operator inside and outside the brackets by removing the brackets . Distribution Law ( ) = ( ) ( ) AND form: OR form: The value outside of the bracket (e.g. A) is multiplied by both values inside the brackets , forming two new brackets which are linked by the logical operator formerly within the bracket . ​ Notice that the logical operator role is switched , e.g. AND switches from within the brackets, to between the new brackets. A note about distribution law - The three values may not necessarily be three separate letters (e.g. A, B and C) as B or C could be NOT A for example. A NOT value is considered a new value , e.g. A and Ā are separate values. ​ Another note about distribution law - Exam questions may ask you to perform the distribution law (or any law) in reverse . For example, converting (A+B) . (A+C) into A + (B.C) Boolean Algebra Exam Question Some previous exam questions have listed helpful laws for you but others haven't, so you should know each individual law . In a previous exam, the candidates were given three general laws to help them . P, Q and R just represent three different values.​ P . 1 = P (Identity Law) P . Q + P . R = P. (Q + R) (Distribution Law) P + P = 1 (Complement Law) Using the rules above , candidates were asked to simplify the following expression : X = A . B + A . B The general laws have been give n to you for a reason. You need to look at the laws provided and see which one currently matches the expression in front of you . If you look closely in this example, the second law is very similar to the expression you are asked to simplify so you can use it to make the first simplification, just swap P for A, Q for B and R for NOT B: Using this law P . Q + P . R = P. (Q + R)​ X = A . B + A . B simplifies as: X = A . (B + B) Now you need to see which of the three provided laws can be used with the current expression . ​ The third law is very similar to the expression you now need to simplify further , just swap P for B and NOT P for NOT B: Using this law P + P = 1 X = A . (B + B) simplifies as: X = A . (1) And finally, there is one law left to use. The first law is very similar to the expression you now need to simplify further , just swap P for A. Using this law P . 1 = P X = A . (1) simplifies as: X = A You have now used all three laws and the expression is fully simplified . ​ Remember - Look at the laws that you have been given and see which law matches your expression . Q uesto's Q uestions 2.2 - Boolean Algebra: ​ 1. Draw the example equations and write a brief description of each of the eight Boolean laws : Commutative Law Idempotent Law Complement Law Identity Law Annulment Law Absorption Law Associate Law Distributive Law ​ 2. Below are three Boolean identities: ​ P . P = 0 (P + Q) . R = (P . R) + (Q . R) P + 0 = P ​ Using the three rules above , simplify the following expression: X = (A + B) . Ā​ This law is called ' Inverse Law ' in the Eduqas 2016 teacher guidance but ' Complement Law ' in the 2020 specification. This law is called ' Zero and One Law ' in the Eduqas 2016 teacher guidance but ' Annulment Law ' in the 2020 specification. This law is called ' Associate Law ' in the Eduqas 2016 teacher guidance but ' Association Law ' in the 2020 specification. This law is called ' Distributive Law ' in the Eduqas 2016 teacher guidance but ' Distribution Law ' in the 2020 specification. 2.1 - Logical Operators Theory Topics 3.1 - Network Characteristics

  • Python | 2b - Inputting Numbers | CSNewbs

    top Python 2B - Inputting Numbers Inputting Whole Numbers in Python To enter whole numbers then you must use the int command. int stands for integer (a whole number ) and is typed before input – don’t forget the double brackets at the end . age = int ( input ( "How old are you? " )) print ( "Have you really lived for " , age , "years?" ) = How old are you? 99 Have you really lived for 99 years? Inputting Numbers Task 1 ( Zoo) Type an input line (with int ) to ask the user how many times they’ve been to the zoo . Print a reply that uses the zoo variable (their answer). Example solution: How many times have you been to the zoo? 3 You've been to the zoo 3 times? I love animals! Inputting Decimal Numbers in Python Using float instead of int allows a decimal number to be entered instead. Again, don’t forget the double brackets at the end . miles = float ( input ( "How far have you walked today? " )) print ( "You really walked for " , miles , "miles? Wow!" ) = How far have you walked today? 5.6 You really walked for 5.6 miles? Wow! Inputting Numbers Task 2 ( Height ) Type an input line (with float ) to ask the user their height in metres. ​ Print a reply that uses the height variable (their answer). Example solution: What is your height in metres? 1.82 You are 1.82 metres tall? Wow! ⬅ 2a - Inputting Text Sect ion 2 Practice Tasks ➡

  • | CSNewbs

    Preparation is the key to success. I won't say "Good Luck", because luck won't make you pass an exam. Focus and effort will. Thanks sir, now let me use your awesome site.

bottom of page