Search CSNewbs
286 items found for ""
- Algorithms | CSNewbs
Algorithms Pseudocode 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 real 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 flowchart A flowchart can be used to visually represent an algorithm. The flowchart symbols are: Algorithm Example example Pseudocode {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 Stop Flowchart
- OCR CTech IT | Unit 1 | 2.2 - Applications Software | CSNewbs
2.2: Applications Software Exam Board: OCR Specification: 2016 - Unit 1 What is applications software? Don't confuse applications software and apps . Apps generally have a single use, such as Angry Birds or the flashlight tool on a phone. Applications Software can be used for a number of different functions depending on the user's needs and their purpose. Productivity Software This is general use software for completing tasks accurately and efficiently . Key examples include word processors (e.g. Microsoft Word or Google Docs), presentation software (e.g. Microsoft PowerPoint or Google Slides) and web browsers (e.g. Microsoft Edge or Google Chrome). Email applications (e.g. Microsoft Outlook or Gmail) are beneficial to organisations because staff can send information to many customers at once which is a simpler and less costly method of communication than something like sending letters or leaflets in the mail. Emails can also include attachments of important documents and include multimedia elements like images and videos to make communication more interesting . Databases and Spreadsheets Database tables and spreadsheets can store both numerical and textual data ready for analysis. Examples include simple database tables and financial spreadsheets of a company's profits this year. Microsoft Access is an example of database software that uses tables and Microsoft Excel is an example of spreadsheet software. Data can be sorted numerically or alphabetically for both software types but graphs can be created from spreadsheets to visualise data . When using spreadsheets (or databases) records can be locked ('record locking' ) so that only one person can make edits at any one time. Edits will be saved before unlocking the file. This will stop data being incorrectly overwritten and will ensure that the data in the spreadsheet is up-to-date, accurate and fit for purpose. An advantage of databases over spreadsheets is that data can be atomised - stored in separate tables but linked through relationships. Development Tools These are tools for programmers who are creating or modifying software . An integrated development environment ( IDE ) is software used to create and edit programs. An IDE features a number of tools including: A translator is a program that converts one type of language into another. A compiler is a type of translator that converts instructions into machine code (binary). A debugger is used to test code and display errors . Other development tools aid programmers with developing and maintaining websites and apps for phones / tablets. Wix.com has been used to create and update this website. Business Software This is specialist software for businesses , often made bespoke for an organisation. One example of business software is design packages such as CAD / CAM (C omputer-A ided D esign / C omputer-A ided M anufacturing). This is the use of software to design and construct products . Workers such as manufacturers and dentists use this type of software. Another type of business software is project management software that allows teams of workers to collaborate and divide projects into manageable tasks. Expert systems use large databases for automatic decision making , such as medical diagnosis programs . Further examples of business software, such as Management Information Systems (MIS), can be found in 3.5 . Q uesto's Q uestions 2.2 - Applications Software: 1. State four different kinds of productivity software and briefly describe how each could be used . For example: "Word processors can be used to type up a letter in an office or write an essay for school." [8 ] 2. Describe two differences between database and spreadsheet software. [2 ] 3a. What is an Integrated Development Environment ? [1 ] 3b. Describe three tools used in an IDE. [6 ] 4. Giving brief examples of how they can be used, state four different types of business software . [8 ] 5. Suggest how a website design company could use each of the three types of applications software (Productivity Software , Development Tools and Business Software ). [ 6 ] 2.1 - Types of Software Topic List 2.3 - Utility Software
- 2.1 - Logical Operators - Eduqas GCSE (2020 spec) | CSNewbs
2.1: Logical Operators & Truth Tables Exam Board: Eduqas / WJEC Specification: 2020 + What is a logical operator? Inside of each computer system are millions of transistors . These are tiny switches that can either be turned on (represented in binary by the number 1 ) or turned off (represented by 0 ). Logical operators are symbols used to represent circuits of transistors within a computer. The four most common operators are: NOT AND OR XOR What is a truth table? A truth table is a visual way of displaying all possible outcomes of a logical operator. The input and output values in a truth table must be a Boolean value - usually 0 or 1 but occasionally True or False. NOT A NOT logical operator will produce an output which is the opposite of the input . NOT is represented by a horizontal line . Boolean Algebra Notation written as NOT A A Truth Table AND An AND logical operator will output 1 only if both inputs are also 1 . AND is represented by a full stop. Boolean Algebra Notation written as A AND B A.B Truth Table OR An OR logical operator will output 1 if either input is 1 . OR is represented by a plus. Boolean Algebra Notation written as A OR B A+B Truth Table XOR An XOR (exclusive OR) logical operator will output 1 if the inputs are different and output 0 if the inputs are the same . XOR is represented by a circled plus. Boolean Algebra Notation written as A XOR B A B Truth Table Multiple Operations Exam questions will ask you complete truth tables that use more than one logical operator . Work out each column in turn from left to right and look carefully at which column you need to use. Simplification You may be asked to use a truth table to simplify an expression . This is actually really easy. Once you've completed the truth table see if any columns match the final expression . A+B and A+(A+B) both result in the same values , therefore: A+(A+B) can be simplified as just A+B. Q uesto's Q uestions 2.1 - Logical Operators: 1. Copy and complete the following truth tables: 1b. Simplify the expression in the second truth table. 2a. A cinema uses a computer system to monitor how many seats have been allocated for upcoming movies. If both the premium seats and the standard seats are sold out then the system will display a message. State the type of logical operator in this example. 2b. For the more popular movies, the cinema's computer system will also display a message if either the premium seats or the standard seats have exclusively been sold out. However, it will not output a message when both have been sold out. State the type of logical operator in this example. 1.6 - Additional Hardware 2.2 - Boolean Algebra Theory Topics
- 4.1 - Number Systems - Eduqas GCSE (2020 Spec) | CSNewbs
4.1: Number Systems Exam Board: Eduqas / WJEC Specification: 2020 + What is binary? By now you should know that computer systems process data and communicate entirely in binary . Topic 1.4 explained different binary storage units such as bits (a single 0 or 1), nibbles (4 bits) and bytes (8 bits). Binary is a base 2 number system. This means that it only has 2 possible values - 0 or 1 . Because binary is a base 2 number system, binary numbers should be written out with a 2 after them, like this: 10101002 What is denary? Denary (also known as decimal ) is the number system that you've been using since primary school. Denary is a base 10 number system. This means that it has 10 possible values - 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 . Because denary is a base 10 number system, denary numbers should be written out with a 10 after them, like this: 165 10 How to convert from binary to denary: How to convert from denary to binary: What is hexadecimal? Hexadecimal is a base 16 number system. This means that it has 16 possible values - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F . Because hexadecimal is a base 16 number system, hexadecimal numbers should be written out with a 16 after them, like this: 6E16 Hexadecimal is used as a shorthand for binary because it uses fewer characters to write the same value . This makes hexadecimal less prone to errors when reading or writing it , compared to binary. For example, 1001111010112 is 9EB16 . Hexadecimal only uses single-character values. Double-digit numbers are converted into letters - use the table on the right to help you understand. How to convert from binary to hexadecimal: How to convert from hexadecimal to binary: Converting from denary to hexadecimal / hexadecimal to denary To convert from denary to hexadecimal or the other way round you must convert to binary first . Denary > Binary > Hexadecimal Hexadecimal > Binary > Denary Use the videos on this page if you need help converting to or from binary. The most common number systems question in exams are from denary to hexadecimal or from hexadecimal to denary so make sure that you practice these conversions. Q uesto's Q uestions 4.1 - Number Systems: 1. Explain why hexadecimal numbers are used as an alternative to binary . Use an example . [ 3 ] 2. Convert the following values from binary to denary : a. 00101010 2 b. 11011011 2 c. 01011101 2 d. 11101110 2 e. 01011111 2 [1 each ] 3. Convert the following values from denary to binary : a. 35 10 b. 79 10 c. 101 10 d. 203 10 e. 250 10 [1 each ] 4. Convert the following values from binary to hexadecimal : a. 11110101 2 b. 01100111 2 c. 10111010 2 d. 10010000 2 e. 11101001 2 [1 each ] 5. Convert the following values from hexadecimal to binary : a. C2 16 b. 8A 16 c. DE 16 d. 54 16 e. F7 16 [1 each ] 6. Convert the following values from denary to hexadecimal : a. 134 10 b. 201 10 c. 57 10 d. 224 10 e. 101 10 [1 each ] 7. Convert the following values from hexadecimal to denary : a. 32 16 b. A5 16 c. 88 16 d. C0 16 e. BE 16 [1 each ] Watch on YouTube Watch on YouTube Watch on YouTube Watch on YouTube Click the banners above to try self-marking quizzes (Google Form) on these topics. Denary to Binary: Binary to Denary: Binary to Hexadecimal: Hexadecimal to Binary: 3.9 Protection Against Threats Theory Topics 4.2 - Signed Binary
- HTML List of Tags | CSNewbs
Here you can find a list of tags. Click a tag to see how to use it. Tags for Eduqas GCSE:
- OCR CTech IT | Unit 1 | 3.5 - Business Systems | CSNewbs
3.5 - Business Systems Exam Board: OCR Specification: 2016 - Unit 1 Businesses have developed many systems to manage and manipulate data and aid business practices. Management Information System (MIS) An MIS is used to collect, store, analyse and present data for an organisation. The system processes a large amount of data and organises it (such as in databases) so that it can be used for decision making and general data analysis . An efficient MIS can be used to display the financial status of an organisation, highlight areas of improvement and generate sales forecasts based on current data. Specifically, a bank could use an MIS for: Looking at numbers of customers that visit each branch. Forecasting takings based on historical data. Profiling customers. Identifying customers who haven’t saved recently to target them for email. Benefits of an MIS: Integrated system: A Management Information System shares a large amount of data from multiple departments within an organisation to produce accurate reports. For example, financial data can be used to generate accurate pay slips. Decision Making: An MIS can be used to inform an organisation's decision making by highlighting areas that need improvement within the company. Powerful analysis: An MIS will use large data sets to provide accurate data analysis that can be used in many different ways by an organisation. Trends and patterns can be identified easily. Backup capabilities: Data can be stored centrally and backed up easily if a disaster occurs. Limitations of an MIS: Cost and installation: An MIS is an expensive tool that needs to be professionally set up and requires technical knowledge to maintain. Requires accurate data: If any data is incorrect or out of date then the analysis will consequently be inaccurate . Potentially disastrous decisions could be made as a result of incorrect data. Training: Employees will need to be trained to use the software accurately for maximum efficiency. Customer Relationship Management (CRM) A CRM system is used to improve the relationship between an organisation and its customers . It can be used to increase customer loyalty with those who already subscribe to their services as well as used to try and increase the customer base by attracting new customers. The ultimate goal of a CRM system is to increase and retain customers which will result in more sales and higher profits . Examples of CRM systems: Marketing teams tracking which promotions customers are responding well to . Customer service teams responding quickly to customer complaints , through a variety of channels (such as social media, emails and telephone calls). Marketing teams rewarding customers who have spent a certain amount in a year. Standard Operating Procedures (SOP) A standard operating procedure is a comprehensive step-by-step guide of how to carry out a business routine. An organisation will create an SOP to abide by legal requirements and high company standards . SOPs must be followed in exactly the same method each time and by each employee to ensure the same outcome and remove any inconsistencies . Benefits of Standard Operating Procedures: Ensures consistency: The outcome should be the same each time when following SOPs which ensures an efficient result . Fewer errors: If all employees follow the SOP carefully then there should be no errors . Meets legal requirements : The SOPs will be designed to meet up-to-date legislation as well as any standards that the company have set. Limitations of Standard Operating Procedures: Inflexible practice: A lot of time may be spent on creating the paperwork and admin instead of the actual job. Legal updates: The SOPs must be periodically reviewed and updated to take into account any new laws . Sales Ordering Process (SOP) This is the process of a customer buying a product or service and the company reviewing the purchase. 1. The customer orders a product or service, usually via email or telephone conversation. 2. The order is confirmed and a sales order is created. This is a document that lists the customer’s requirements and exactly what they have purchased. 3. The sales order is sent to the relevant departments (e.g. production, finance and delivery) so they can fulfil the customer’s request . Once the order has been completed the customer will be sent an invoice for payment . The SOP is important as it creates a clear plan for ordering a product. Each department can use the sales order to know exactly what jobs to perform. Help Desk Help desk software is used to provide real-time support to a user from a trained member of staff to overcome a technical problem . The customer logs an issue in the form of a ticket and is assigned a technician . As the technician tries to communicate with the user and solve the issue they must follow a service level agreement that defines the high standards the technician must keep to. When the problem has been solved the ticket is closed. All tickets are archived so that persistent problems can be checked. If Help Desk software is used within a company to report and solve issues it is known as in-house . Benefits of Help Desk software: Keeping Track: C ustomers can see that their issues are being dealt with and administrators have clear records of the problem. Audit Logs: All tickets are archived so if a problem occurs on the same machine the previous solution can be attempted again . Communication : Formal messages between the customer and the administrator mean there are no mixed messages and a running dialogue can take place as the problem is fixed. Limitations of Help Desk software: Cost : Setting up the necessary software and hardware and paying for an administrator to run the system can cost a large amount of money. Availability issues: A technician might not be available 24/7 or during holidays. Formal structure: This is a formal system that takes time to record and respond to which might annoy staff when it is only a minor issue to be fixed, like resetting a password. Knowledge: Technicians need technical expertise regarding the company's computer systems and need to be able to fix both hardware and software issues. This might require additional training every few years. Ticket Response Time: Administrators must ensure that all tickets are read and responded to in reasonable time so that productivity in the company is not affected. Q uesto's Q uestions 3.5 - Business Systems: 1a. What is the purpose of an MIS ? [ 2 ] 1b. Describe 3 ways a bank could use an MIS . [ 3 ] 1c. Describe the benefits and limitations of an MIS . [10 ] 2a. What is the purpose of a CRM ? [ 4 ] 2b. Describe 3 ways that a CRM could be used by a company . [6 ] 3a. What are standard operating procedures (SOP ) and why are they used? [ 4 ] 3b. Describe the benefits and limitations of SOPs . [ 10 ] 4a. What is the sales ordering process ( SOP )? [ 2 ] 4b. Why is the SOP important in a company? [ 2 ] 4c. Summarise the 3 stages of the SOP . [ 4 ] 5a. What is the purpose of help desk software? [ 2 ] 5b. Explain how help desk works , including tickets , technicians and service level agreements . [3 ] 5c. Describe the benefits and limitations of Help Desks . [ 10 ] 3.4 - Connection Methods Topic List 4.1 - Communication Methods
- 5.1 - Operating Systems - OCR GCSE (J277 Spec) | CSNewbs
5.1: Operating Systems Exam Board: OCR Specification: J277 What is an Operating System? An operating system (OS ) is software that helps to manage the resources of a computer system and provide the interface between the user and the computer’s hardware . There are five main functions of an operating system: Memory Management & Multitasking All programs must be temporarily stored in RAM for the CPU to be able to process them. The OS transfers programs in and out of memory from the hard drive (or virtual memory ) when processing is required - programs are removed from RAM when closed to free up space for other tasks. The operating system can only perform one process at a time , but through memory management it can appear that more than one process is being executed - this is called multitasking . Peripherals Management & Drivers A peripheral is an external device connected to a computer system to input or output data . Data is transferred between external devices and the processor and this process needs to be managed by the operating system . A device driver is a program that provides an interface for the OS to interact and communicate with an external device . Drivers are hardware dependent and OS-specific . The driver translates the OS’ instructions into a format the specific hardware can understand . Because the CPU and the peripheral will process data at different speeds , a buffer is typically used to temporarily store data until it can be processed . User Management The OS allows users to create , manage and delete individual accounts . User accounts can be granted different access rights such as an administrator or guest . The OS will manage security settings such as allowing passwords to be reset and can also be used to monitor login activity . File Management The operating system creates and maintains a logical management system to organise files and directories (folders ). File management allows files to be named , renamed , opened , copied , moved , saved , searched for , sorted and deleted . It also allows users to set access rights for specific files and to view file properties . User Interface The final function of an operating system is to provide a user interface , allowing a human to interact with the computer system . The way in which a user can navigate a computer system is known as human-computer interaction ( HCI ). Graphical User Interface (GUI) The most common type of user interface is a graphical user interface (GUI ) which can be presented in the following ways: Icons are displayed to represent shortcuts to applications and files. Multiple windows can be opened at the same time and switched between. A folder and file system is displayed and manipulated allowing for copying , searching , sorting and deleting data. The interface can be customised , such as changing font sizes and the desktop background . The taskbar allows shortcuts to be pinned for quick access . Menus can be opened from the Start button to display files and shortcuts. System settings can be accessed such as network and hardware options . Command-Line Interface Other types of user interface do exist, such as a command-line interface (CLI ). This type of interface is entirely text-based and requires users to interact with the system by typing commands . This is a complicated process and mistakes could easily accidentally delete data. There are many commands to learn so only experts who have been trained t o learn this interface will be able to efficiently make use of it. Menu-Driven Interface A menu-driven interface displays data in a series of linked menus . Examples include cash machines (ATMs) and old iPods . This type of interface is generally user friendly and easy to use as commands do not need to be memorised. However it can be annoying to find specific data through a large number of menus without a search feature. Touch-Sensitive Interface Another type of user interface is a touch-sensitive interface , used with smartphones and tablets . A human interacts with the device by pressing on a touchscreen , making it very intuitive and suitable for most users without training. Touch-sensitive interfaces may not work with dirty or wet fingers and it will take longer to write text compared to using a keyboard. Voice-Driven Interface A voice-driven interface can be controlled by speaking commands aloud to a listening device. Examples include Amazon's Alexa devices, Apple's Siri technology and Google Home . This interface is intuitive , can be used hands-free and helps to speed up processes . However commands may be misheard or limited in what can be performed. Q uesto's Q uestions 5.1 - Operating Systems: 1. Describe each role of the operating system : Providing a user interface [ 3 ] Memory management (and multitasking) [ 3 ] Peripheral management (and drivers) [ 3 ] User management [ 3 ] File management [ 3 ] 2. Describe 5 different ways the operating system can provide a graphical user interface (GUI) . [5 ] 3. Describe one advantage and one disadvantage of using the following types of human-computer interaction (HCI) : a. Command-Line interface [ 4 ] b. Touch-Sensitive interface [ 4 ] c. Menu-Driven interface [ 4 ] d. Voice-Driven interface [ 4 ] 4.2 - Preventing Vulnerabilities Theory Topics 5.2 - Utility Software
- Python | 3a - Data Types | CSNewbs
top Python 3a - Data Types Data Types in Python If you are a Computer Science student you need to know about the different data types that are used in programming. String – A sequence of alphanumeric characters (e.g. “Hello!” or “Toy Story 4” or “Boeing 747” ) Integer – A whole number (e.g. 1470 or 0 or -34) Float (also called Real ) – A decimal number (e.g. -32.12 or 3.14) Boolean – A logical operation (True or False) Character – A single alphanumeric character (e.g. “a” or “6” or “?”) [ Not used in Python as it would just be a string with a length of 1] Converting to Another Data Type Converting a variable from one data type to another is called casting . Casting Commands str (variable_name) converts a variable to a string . int (variable_name) converts a variable to a integer . float (variable_name) converts a variable to a float (decimal number). An integer (or float ) value may be cast into a string so that it can be used with + as part of a sentence to avoid spaces . total = 45 print ( "You owe £" , total , "in total." ) print ( "You owe £" + str (total) , "in total." ) = You owe £ 45 in total. You owe £45 in total. When dividing an integer the answer is automatically given as a decimal number (float ), even if it is .0 (e.g. 10 / 2 would give 5.0). Casting a float (also known as real) number into an integer using int() will remove the decimal . total = 100/10 print ( "The answer is" , total ) print ( "The answer is" , int(total) ) The answer is 10.0 The answer is 10 = Data Types Task 1 ( Time) Write an input line with int to ask the current hour . Write another input line with int to ask the current minute . Write a print line with str() that outputs this as a clock time. Example solution: What is the hour? 12 What is the minute? 44 The time is 12:44 Data Types Task 2 ( Decimal ) Write an input line with int to ask for any number . Use float() in a print line to output number as a decimal. Example solution: Enter any number: 456 456.0 ⬅ Section 2 Practice Tasks 3b - Simple Calculations ➡
- 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
- 10.3 - Programming Errors - Eduqas (2020 Spec) | CSNewbs
10.3: Programming Errors Exam Board: Eduqas / WJEC Specification: 2020 + Syntax Error A syntax error is a mistake in the grammar or spelling of the program. A syntax error will prevent the program from being compiled . Examples: Incorrect Spelling: pront ( "hello" ) Incorrect punctuation: print ( "hello" ( Execution (Runtime) Error An execution error is when the program unexpectedly stops as a result of an operation during execution . Examples: Dividing by zero: 400 / 0 Reading too far in a file: #There are 50 lines in the file line = file.readlines( ) print ( line [100] ) Logical Error Linking Error A logical error is a mistake made by the programmer - the program still works but displays the wrong output . Examples: Truncation Error Rounding Error A linking error occurs when a compiler can’t find a sub procedure (e.g. the random library in Python) that has been used. The programmer might have declared it incorrectly or forgotten to link (import) it . Examples: Spelling an import command incorrectly: import ramdon number = random.randint(1,10) Requesting a function without linking: number = random.randint(1,10) Incorrect calculation: total = num1 - num2 print (total) Incorrect variable printed: age = 16 name = "Steve" print ( "Nice to meet you" , age) A rounding error is when the program rounds a real number to a fixed number of decimal places. This results in losing some value as the number becomes less accurate . Examples: Rounding up: 80.87 = 80.9 (Inaccurate by 0.03) Rounding down: 63.4 = 63 (Inaccurate by 0.4) A truncation error is when the program truncates a real number to a fixed number of decimal places . This results in losing some value as the number becomes less accurate . Examples: Truncation to 2 decimal places: 92.13787 = 92.13 (Inaccurate by 0.00787) Truncation to 1 decimal place: 25.199876 = 25.1 (Inaccurate by 0.099876) Q uesto's Q uestions 10.3 - Programming Errors: 1. Describe and give an example of each type of error: a. Syntax Error [ 3 ] b. Execution (Runtime) Error [ 3 ] c. Logical Error [ 3 ] d. Linking Error [ 3 ] e. Rounding Error [ 3 ] f. Truncation Error [ 3 ] 2. State the error that will occur for each scenario: [1 each ] a. A command word (such as for or print) has been misspelt. b. The average speed is 120.3856 but only 120.3 is displayed. c. The cost of a meal is £47 but £40 is displayed. d. A program uses a subroutine that has not been imported. e. The height of a dog is 33.38cm but 33.4cm is displayed. f. The user wants to read line 9 of a file that only has 6 lines. g. The user's age is printed instead of their name. h. The programmer has typed print("hello"( i. A number is divided by 0. j. The program is asked to generate a random number but 'import random' has not be written. 10.2 - Stages of Compilation Theory Topics 11.1 - Impacts of Technology
- Python | Section 8 Practice Tasks | CSNewbs
top Python - Section 8 Practice Tasks Task One Write a program with a blank list. Use the .append() command to add your three favourite ice-cream flavours to this list and then print the list. Example solution: Task Two Write a program with a list of any 5 numbers. Print the list. Delete the first and third numbers. Print the list. Example solution: Task Three Write a program with a list of three different animals. Write an input line that lets the user type an animal. Add what the user has written to the list and print the list. Example solution: Task Four Sort your list from task two into order. Then print the list. Example solution: Task Five Copy the text on the right and put it into a list named countries. Count the number of countries in the list. Print the longest country. Use a for loop to work out the length of each country. "Egypt", "Angola", " Eritrea " , "Mozambique" , "Ghana" , "Chad" , "Somalia" , "Namibia" , "Sudan" , "Libya" , "Algeria", "Morocco" , "Cameroon" Example solution: Task Six Create a dictionary (see 8c ) that asks users questions about yourself, such as first name, favourite colour or birthday. Let the user answer each question and display the answer if they get it correct. Use the 'Using a Dictionary to Make a Game ' section of 8c to help you. Example solution: ⬅ 8c - Dictionar ies 9a - String Handling ➡
- Python | 8c - Dictionaries | CSNewbs
top Python 8C - Dictionaries Creating a Dictionary Dictionaries are used in Python to link items of data together . The example on this page uses a footballer dictionary which links a player with a team they played for. To define a dictionary, use curly brackets { } and separate linked data with a colon . A dictionary can be written on one line but the method below makes it easier to read: Printing Data from a Dictionary The first part of the linked data in a dictionary is called the key (e.g. each footballer in my example above). The second part of the linked data in a dictionary is called the value (e.g. each team). Example: key : value "Harry Kane" : "Tottenham Hotspur" A for loop can be used to cycle through each set of keys and values in the dictionary: Practice Task 1 a) Create a dictionary of your teachers and the subject they teach. b) Print their name and the subject they teach on each line. Example solution: Adding and Removing Data from a Dictionary Data can be added to a dictionary by stating the new key and value . You must use square brackets - [ ] The new data will be added to the end of the dictionary. You can print the whole dictionary to see any changes - e.g. print(playerdictionary) Data can be removed from a dictionary by stating the new key to remove in a pop command. You can print the whole dictionary to see any changes - e.g. print(playerdictionary) The whole dictionary can be cleared (reset to blank) using the clear command. Practice Task 2 a) Ask the user to enter a new teacher and their subject. b) Ask the user to remove a teacher. c) Print the list of teachers and check the new teacher has been added and the other one removed. Example solution: Searching Through a Dictionary An if statement can be used to check if a specific key is in a dictionary. If the key is in the dictionary then a message can be displayed using the key and the value . Otherwise, an else statement can output an appropriate response. To search for a value in a dictionary a for loop should be used to cycle through each key . If the value of each key matches the value that is being searched for then it will be printed. Practice Task 3 a) Create a search that allows a user to enter a teacher's name and prints the subject that they teach. b) Include an else statement to print a response if a teacher is not in the dictionary. Example solution: Changing Data & Copying a Dictionary The way to change values is similar to adding new data. The first input below is to determine the key and the second input determines the new value to be changed to. The copy command is used to make a duplicate of a dictionary . Practice Task 4 a) Create a copy of your teacher dictionary. b) Allow the user to enter a teacher and a new subject that they teach. c) Print the copy of the dictionary with the new values. Example solution: Using a Dictionary to Make a Game The code below is used to make a puzzle game where the user has to type in a footballer and the team they played for. I have added comments to explain the different parts of the code. A separate list has been created at the start to store the names of keys (players) that been correctly guessed . A while loop is used to constantly ask the user for players and teams. When they have guessed all 10 players (and the correct list reaches 10 ) the loop breaks and the game end. Instead of a further practice task here, Task 6 of the Section 8 Practice tasks page challenges you to make a similar game using a dictionary. ⬅ 8b - 2D Lists Section 8 Practice Tasks ➡