Search CSNewbs
304 results found with an empty search
- HTML Guide 6 - Organisation | CSNewbs
Learn about the tags that improve the layout of a web page, including how to centre content and add horizontal lines, bullet points and block quotes. 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
- OCR CTech IT | Unit 1 | 4.1 - Communication Skills | CSNewbs
Learn about things to consider when trying to make a good impression at work, including written, verbal and physical considerations. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification. 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 communication between people may be received or understood incorrectly . For example, noise in the room , language (this could be different spoken languages or the use of difficult technical terms ) and impairments (such as a hearing or visual impairment ). 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 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
- OCR CTech IT | Unit 1 | 5.6 - Data Disposal | CSNewbs
Learn about laws regarding suitable data disposal of information and computer systems as well as methods including electromagnetic wipe and physical destruction. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification. 5.6 - Data & System Disposal Exam Board: OCR Specification: 2016 - Unit 1 Computer components such as circuit boards, processors and monitors contain hazardous materials that cannot be disposed of in traditional ways such as rubbish collection and landfills. For security reasons, data must also be disposed of carefully so that it is not returned to a readable format by unauthorised viewers . Legislation In recent years, the government has introduced different laws that relate to the safe disposal of computer equipment to help reduce environmental impact . Waste Electronic and Electrical Equipment ( WEEE ) Directive : This provides guidance on how hazardous materials should be disposed of safely . This includes materials such as mercury (found in smartphones and newer monitors ) and toner cartridges in printers . These materials can damage the environment if not disposed of appropriately . Waste Acceptance Criteria ( WAC ): Equipment must meet these rules before it can be sent to a landfill . Hazardous materials, such as the elements in computer monitors , do not meet these criteria and should not be accepted . Hazardous Waste Directive : This ensures businesses safely store hazardous materials and use authorised businesses to dispose of the waste . Hazardous materials include mercury and hexavalent chromium . Data Protection Act ( DPA ): One principle of the DPA specifies that data should only be kept for a reasonable amount of time until it is securely deleted . Data stored on customers should be checked regularly and permanently deleted if no longer required . Methods of Data & System Disposal Overwriting is when new data is written to the hard disk drive to replace the current data - essentially resetting the data . Remember all data stored by a computer is in a binary format . Overwriting just once is usually not enough to remove all evidence of the data and the process may be repeated several times . Overwriting data causes no damage and means the drive can still be used for other purposes afterwards. Electromagnetic wiping uses a machine called a degausser , which has a very strong electromagnetic coil , to completely wipe the hard disk drive . Many large organisations use degaussers to be sure that their data is no longer on the devices they have used so it can’t be restored and accessed by unauthorised viewers . Degaussers are expensive to buy but it allows the device to be used again for other purposes afterwards as it is not physically damaged. A third option is the physical destruction of a computer system or storage device , like a hard disk drive , which guarantees the data is permanently inaccessible . However, physical destruction also renders the storage media unusable again for other purposes. Examples of physical destruction include shredding (e.g. a CD shredder ) or tools such as sledgehammers if no other option is available. Q uesto's Q uestions 5.6 - Data & System Disposal: 1. Describe the purpose of 4 different pieces of legislation relating to how data or computer systems should be disposed of safely . [8 ] 2a. State 3 methods of data and system disposal . [3 ] 2b. Describe 1 advantage and 1 disadvantage of using each method you stated in 2a. [6 ] 5.5 - Digital Security Topic List
- Little Man Computer Editor | CSNewbs
A simple Little Man Computer (LMC) editor. Perfect for students learning A-Level Computer Science in UK schools. Little Man Computer (LMC) Editor You can use this simple Little Man Computer ( LMC ) editor below to check any LMC code you have written to ensure it outputs correctly . Use the reminders on the right for the 11 commands needed in the OCR A-Level specification . LMC is a simplified form of assembly language . This page is under active development. INP is used without a label to input a number . The number is temporarily stored in the accumulator. Example: INP OUT will output the current value of the accumulator. Example: OUT STA stores the value that is currently in the accumulator into a named memory location. Example: STA num1 ADD is used to add the value of a named memory location to the value currently stored in the accumulator. Example: ADD num1 SUB takes away the value of a named memory location from the value currently stored in the accumulator. Example: SUB num1 LDA is used to load the value of a stored variable into the accumulator. Example: LDA num1 BRZ is used to branch to a labelled line of code if the value in the accumulator is exactly 0 . Example: BRZ ifzero BRP is used to branch if the value in the accumulator is currently positive (including 0). Example: BRP repeat BRA is used to branch regardless of the accumulator's current value . Example: BRA loop HLT will stop the program. Example: HLT DAT defines and stores data in memory. It creates a variable or memory location that can hold a specific value. It is written after the final HLT command. Example: fifty DAT 50
- 3.7 - The Internet - Eduqas GCSE (2020 spec) | CSNewbs
Learn about internet topics including web browsers, URL structure and DNS servers. Based on the 2020 Eduqas (WJEC) GCSE specification. 3.7: The Internet Exam Board: Eduqas / WJEC Specification: 2020 + What is the internet? The internet is a global network of interconnected networks . The world wide web (WWW ) is not the same as the internet. It is a way of accessing information , using protocols such as HTTPS to view web pages . What is a web browser? A web browser is software that uses the HTTP or HTTPS protocol to access and display web pages . Popular web browsers include Google Chrome , Mozilla Firefox and Microsoft Edge . What is a URL? URL stands for Uniform Resource Locator . Web pages are accessed by typing a URL (a web address) into the address bar of a web browser . The URL is the complete address that matches an IP address where the website is stored. We use URLs because they are easier to remember than IP addresses, for example, 'twitter.com' is simpler than '199.59.149.165'. What is the structure of a URL? A URL is structured into different segments: What is a DNS Server? A DNS ( Domain Name System ) server stores a list of domain names and a list of corresponding IP addresses where the website is stored. The first thing to understand is that every web page has a domain name that is easy for humans to remember and type in (such as www.csnewbs.com ) as well as a related IP address (such as 65.14.202.32) which is a unique address for the device that the web page is stored on. The steps taken to display a web page: 1. A domain name is typed into the address bar of a browser . 2. The browser checks a local (cached) host file to check if it already holds the IP address, but if it doesn't... 3. A query is sent to the local DNS server for the corresponding IP address of the domain name . www.facebook.com 4. The local DNS server will check if it holds an IP address corresponding to that domain name. If it does it passes the IP address to your browser . 66.220.144.0 5. The browser then connects to the IP address of the server and accesses the web site . If the local DNS server does not hold the IP address then the query is passed to another DNS server at a higher level until the IP address is resolved. If the IP address is found, the address is passed on to DNS servers lower in the hierarchy until it is passed to your local DNS server and then to your browser. Q uesto's Q uestions 3.7 - The Internet: 1a. Describe the difference between the internet and the world wide web ( WWW ). [ 2 ] 1b. What is the purpose of a web browser ? [ 2 ] 1c. Why do humans use URLs instead of IP addresses? [ 1 ] 1d. Write out the following URL and label each section: https://www.skynews.co.uk/worldnews/ukstockmarket [ 6 ] 2a. What is a DNS server ? [ 2 ] 2b. Describe, using a mix of text and icons / images , how a DNS server is used to display a web page . [5 ] 2c. Describe how a DNS server searches for an IP address if it is not found on the local DNS server . [ 2 ] 3.6 - 7-Layer OSI Model Theory Topics 3.8 - Cyber Threats
- 6.2 - Utility Software - Eduqas GCSE (2020 Spec) | CSNewbs
Learn about utility software including antivirus, firewall, compression, disk partitioners, defragmenters, backup and file managers. Based on the 2020 Eduqas (WJEC) GCSE specification. 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
- 2.1 - Software Development Models | F160 | Cambridge Advanced National in Computing | AAQ
Learn about the characteristics, diagrammatic representations, advantages, disadvantages, and suitability of software development models. These include the waterfall, rapid throwaway, incremental, evolutionary, rapid application development (RAD), spiral and agile models. Resources based on Unit F160 (Fundamentals of Application Development) for the OCR Cambridge Advanced National in Computing (H029 / H129) AAQ (Alternative Academic Qualification). Qualification: Cambridge Advanced National in Computing (AAQ) Unit: F160: Fundamentals of Application Development Certificate: Computing: Application Development (H029 / H129) 2.1 - Software Development Models Watch on YouTube : Software Development Models Waterfall Rapid Throwaway Incremental Evolutionary Rapid Application Development Spiral Agile There are seven software development models you need to know : Traditional models: Waterfall Prototype models: Rapid Throwaway , Incremental , Evolutionary Iterative models: Rapid Application Development (RAD) , Spiral , Agile For each development model , you need to know : Its characteristics . How to represent it in a diagram . Its advantages and disadvantages . The types of development it is suitable for. Software Development Models Each development model has its own video below but you also need to know the advantages and disadvantages of using development models in general. Waterfall Model The waterfall model is a linear and structured approach where each phase is completed one at a time in order . It needs all requirements to be clearly defined at the start , with little to no changes allowed once a phase is finished . This model is best suited for projects with fixed requirements and minimal risk of change . Rapid Throwaway Prototype Model The rapid throwaway prototype model involves quickly creating temporary prototypes to explore ideas and gather user feedback before building the final system . Prototypes are discarded after they help refine requirements , and are especially useful in projects where user needs are initially unclear . This model is suitable when user interaction and efficient interface design are critical . Incremental Model The incremental model develops a system in small , manageable sections with each part being designed , built and tested individually . Functionality is added step by step until the full system is complete . This approach allows for early partial deployment and easier handling of changing requirements over time. Evolutionary Prototype Model The evolutionary prototyping model involves building an initial prototype that is continuously improved based on user feedback until it becomes the final system . Unlike throwaway prototyping, the prototype is not discarded but gradually evolves into the full product , once the user is satisfied . This model is ideal when user requirements are expected to change or develop over time . Rapid Application Development (RAD) The rapid application development ( RAD ) model focuses on quickly building software through iterative development and frequent user feedback . It uses reusable components , time-boxing and constant feedback to speed up the delivery of an effective final product . RAD is best suited for projects that need to be completed quickly and where requirements can evolve during development . Spiral Model The spiral model combines iterative development and risk management , progressing through repeated cycles of planning , risk assessment , engineering ( development and testing ) and evaluation . Each loop focuses on identifying and addressing risks early in the project. It is ideal for complex and high-risk projects where requirements may change over time . Agile Model The agile model is an iterative and flexible approach that progresses in small , usable chunks called iterations (or sprints ). It relies on frequent collaboration with stakeholders and user feedback to adapt to changing requirements . This model is ideal for dynamic projects where quick delivery and frequent updates are important. Q uesto's Q uestions 2.1 - Software Development Models: 1. Choose three development models to explain and draw a diagram for each. [6 ] 2. A large company is making the next sequel in a hugely popular video game series , FieldBattle 2043 . Justify which application development model(s) they should use (and which they shouldn't ). [5 ] 3. Describe the advantages and disadvantages of any development models you have not covered in Q1 or Q2 . [6 ] Agile development is named after the ' Agile Manifesto ' - a set of principles for software development agreed by a group of developers at a ski resort in Utah , USA in 2001 . D id Y ou K now? 1.3.3 - App. Software Types Topic List 2.2 - Phases of Development Models
- App Inventor 2 | Simple Apps | CSNewbs
App Inventor Task 1 & 2 - Basic Apps Basic Program #1 - Colour Changer This quick tutorial will teach you how to create an app that changes the background colour when you press different buttons . See the video: In Designer layout, firstly drag four buttons from the Palette tab on the left side and drop them one at a time on top of each other in the Viewer . In the Components tab, click on each button and press Rename to change the name (this makes it easier to code them later). You don't need to choose these four colours, but it is a good idea to start with these (you can change them later). You should notice that you are only changing the name of the button - not the button on the text; these are two different variables . Now to change the text on each button. Click on a button in the centre then in the Properties tab on the right scroll down to Text and change the text to a colour. When you've changed all four button texts, then you can start to code. Click on the Blocks button in the top right to start adding the code. In the Blocks tab on the left click on each button block (e.g. Red, Blue, Green and Yellow) and drag over a 'when click ' block for each colour. Blocks we put inside of the 'when click' blocks will execute whenever that button is pressed. Grab a set Screen 1 BackgroundColor from the Screen1 section in the Blocks tab and place one underneath each when click block. Then line up the correct colour from the Colors section in the Blocks tab to the relevant button. Program 1 Complete! The easiest way to run an app that you have created at home using App Inventor 2 is to download the free MIT AI2 Companion App on your smartphone from the Google Play Store . At the top of the App inventor program on your computer , click on Connect and AI Companion . This will generate a six-digit code you can type into your phone. If your school has the emulator installed, you can also use this to test your app. Ideas to Improve Your App: Use the when Screen1 BackPressed block from the Screen1 section in Blocks to turn the background colour white when the back button is pressed. The block is shown to the right; you can work out how to use it. Add more buttons for different colours. Try purple, black and orange for example. Change the BackgroundColour (in Properties ) of each button to represent the colour it says. You might need to change the TextColour too for red and blue (see the image to the right). Password Checker Basic Program #2 - Password Checker This quick tutorial will teach you how to create an app that requires a user to enter a correct password . See the video - maximise to see it clearly: Firstly you need to grab a TextBox from the Palette tab on the left and place it in the Viewer. Then drag a Button and a Label . Put them in this order: You need to change the Text for the button in the Properties tab to 'Enter Password'. Click on your text box and delete the Hint Text from the Properties tab. Click on the label and delete the Text from the Properties tab. Don't worry, the label is still there! Now time to code. Open up the Blocks layout by clicking Blocks in the top right. Drag a when Button1 click block into the centre from the Button1 section in Blocks . Drag an if then block from Control within the when Button 1 click block. Click on the blue cog button and, in the new window underneath, drag an else block within the if block. The top part will update by itself. When the button is clicked we want to see if the text in the text box matches what we want it to be. Grab an = block from Logic and connect it to the if block. Then place a TextBox1 Text block from TextBox1 in the first half and a blank " " block from Text in the second half. In the " " block write what you want the password to be. I've chosen pikachu because pikachu is cool. Grab a Set Label1 Text block from Label1 and put one next to then and another next to else. Place a " " block from Text and snap it next to both of those blocks. If the user has entered the password correctly then you want 'Correct Password' to appear. Otherwise, if they have entered anything else , you want 'Incorrect Password' to appear. Program 2 Complete! The easiest way to run an app that you have created at home using App Inventor 2 is to download the free MIT AI2 Companion App on your smartphone from the Google Play Store . At the top of the App inventor program on your computer , click on Connect and AI Companion . This will generate a six-digit code you can type into your phone. If your school has the emulator installed, you can also use this to test your app. Ideas to Improve Your App: Change the password to something different. If the correct password is entered change the background to gree n . If an incorrect password is entered change the background to red . You may want to scroll up to the first program as a reminder. KS3 Home Task 3
- 4.1 - Boolean Logic - OCR GCSE (J277 Spec) | CSNewbs
Learn about the three logical operators - NOT, AND and OR - as well as truth tables. Based on the J277 OCR GCSE Computer Science specification (first taught from 2020 onwards). 4.1: Boolean Logic Exam Board: OCR Specification: J277 Watch on YouTube : Boolean Operators & Truth Tables Logic Gate Diagrams 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 three most common operators are: NOT AND OR What is a truth table? Truth tables are used to show all possible inputs and the associated output for each input . The input and output values in a truth table must be a Boolean value - usually 0 or 1 but occasionally True or False. NOT AND OR A NOT logical operator will produce an output which is the opposite of the input . NOT is also known as Negation . The symbol for NOT is ¬ An AND logical operator will output 1 only if both inputs are also 1 . AND is also known as Conjunction . The symbol for AND is ∧ An OR logical operator will output 1 if either input is 1 . OR is also known as Disjunction . The symbol for OR is ∨ NOT Logic Gate AND Logic Gate Symbol OR Logic Gate Symbol Truth Table Truth Table Truth Table Multiple Operators Exam questions could 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 preceding column you need to use. NOT B A AND NOT B A OR (A AND NOT B) As binary is a base-2 number system , the number of rows required in a truth table will double with each new input in the expression in order to show the unique combinations of inputs. The examples above use just two inputs (A + B) so 4 rows are required. e.g. A = 2 rows / A + B = 4 rows / A, B + C = 8 rows / A, B, C + D = 16 rows Logic Diagrams You may be asked in an exam to d raw a logic diagram when given a logical expression . Draw any NOT symbols or expressions in brackets first. A logic diagram for C = ¬A ∧ B A logic diagram for D = C ∨ (A ∧ B) Q uesto's Q uestions 4.1 - Boolean Logic: 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. 3. Draw a logic diagram for C = (¬B v A) ∧ A . 3.2 - Testing Theory Topics 5.1 - Languages & Translators
- Key Stage 3 Python | Calculations | CSNewbs
The fourth part of a quick guide to the basics of Python aimed at Key Stage 3 students. Learn about calculations and simple mathematical operators. Python - #4 - Calculations 1. Creating Calculations To add in Python use + To subtract in Python use - To multiply in Python use * To divide in Python use / Task 1 - Create a new Python program and save the file as 4-Calculations.py Print 4 different calculations - use each operator once.(add/subtract/multiply/divide) Python is very clever, so don't be afraid to make your own calculations using larger numbers and more than one operator . 2. Using Inputs and Calculations You can ask the user to enter numbers by writing input lines. Python can then perform calculations using the numbers that the user has entered. Don't forget to add int ( and double close brackets when using numbers ! Task 2 - Copy the new code from the picture. Change the text and num1 so you are dividing by 5 not 3. Don't delete your earlier code , just add this underneath. I have cropped the images to make the new code clearer. 3. Using Calculations in a Sentence When we have printed the calculations so far, they have not been very informative! You can print calculations together with sentences so that they mean more. Use a comma ( , ) between calculations and sentences . Task 3 - Use the pictures to help you add commas and sentences to your program to be more informative. Challenge Programs Use everything that you have learned on this page to help you create these programs... Challenge Task 1 - Multiplication Create a new Python program. Save it as ' 4 -Multiplication.py ' Add a comment at the top with your name and the date. Write an input line ( don't forget int ! ) that asks the user to enter number 1. Write an input line ( don't forget int ! ) that asks the user to enter number 2. Multiply number 1 and number 2 together and print the answer. BONUS : Try to show number 1 and number 2 in the print statement (see practice task 3 to help you). Remember: Break up variables in a print line by using commas. When you run it, it could look something like this: Challenge Task 2 - Retirement Create a new Python program. Save is as ' 4-Retirement.py ' Add a comment at the top with your name and the date. Write an input line ( don't forget int ! ) that asks the user to enter their age. Print the year that they will turn 65. (This is slightly tricky. Hint : You need to know their age, and you need to know the current year. You need to subtract something, and you need to add something. Try using scrap paper to help you figure it out.) BONUS : Use only one print line. BONUS : Try to use only two lines in total . Remember: Break up variables in a print line by using commas. When you run it, it could look something like this: <<< #3 Inputs #5 Selection >>>
- Python | 9a - String Handling | CSNewbs
Learn how to handle strings (text) in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. top Python 9a - String Handling What is String Handling? String handling refers to the manipulation of a string variable , typical uses include: Checking the length of a variable. Searching a variable for a certain phrase. Checking the number of times a specific character or word is used . String handling is used to examine passwords and to ensure that they are of an acceptable strength (e.g. by checking that they are at least 8 characters in length and include a mixture of capital letters , lowercase letters and symbols ). Password: arsenal Password: $tr0nG_pA$$w0rd Lowercase & Uppercase .lower() and .upper() are functions that convert a string into a fully lowercase or uppercase version. dogbreed = "Chihuahua" print (dogbreed.upper()) CHIHUAHUA character = "sPoNgeBoB" print (character.lower()) spongebob You may have realised that Python is very specific . 'yes ', 'Yes ' and 'YES ' are all treated as different values . Converting user input into one case , such as lowercase, and then comparing that input is a better way of checking an input than having an if statement with multiple or comparisons. The program below converts the user input into lowercase to compare. 'yes', 'Yes' and 'YES' are all converted to 'yes'. answer = input ( "Would you like water? " ) answer = answer.lower() if answer == "yes" : print ( "I'll fetch you a glass." ) else : print ( "Don't dehydrate!" ) Would you like water? yes I'll fetch you a glass. Would you like water? Yes I'll fetch you a glass. Would you like water? YES I'll fetch you a glass. Practice Task 1 Ask the user to enter their first name and surname. Print their surname in uppercase followed by their first name in lowercase. Example solution: Enter First Name: Jayden Enter Surname: Hargrove Welcome HARGROVE, jayden Count Characters The easiest way to count how many times a certain value appears within a string is to use the .count() command. It is important to note that, just like when using an input statement or calculation line, you must save the calculation into a variable . An example, for counting the number of e’s in a sentence, is below: sentence = input ( "Enter your sentence: " ) e_count = sentence.count( "e" ) print ( "There were" , e_count, "e's in your sentence!" ) Enter your sentence: even ellie eats elderberries There were 9 e's in your sentence! Practice Task 2 Create a program that counts how many instances of the letter a have been entered in a sentence. Bonus: Use the .lower() function in your code to include capital letters. Example solution: Enter a sentence: An angry aardvark named Aaron. That sentence had 8 a's. Finding the Length of a String Just like when we wanted to find the length of a list, we use the len command to see how many characters are in a string . It is sensible to save the result of the function into a variable so it can be used later . fruit = input ( "Enter a fruit: " ) length = len (fruit) print ( "That fruit was" , length, "characters." ) Enter a fruit: pineapple That fruit was 9 characters. A common reason for finding the length is as part of validation , for example, checking a password is more than 8 characters : password = input ( "Enter a new password: " ) length = len (password) if length >= 8: print ( "Password accepted!" ) else : print ( "Password is too short, must be at least 8 characters." ) Enter a password: snake54 Password is too short, must be at least 8 characters. Enter a password: pebblesthedog76 Password accepted! Practice Task 3 Create a program that asks for a name. Check that the name is between 4 and 10 characters. Print appropriate messages if it is within this range and if it isn't. Example solution: Enter a name: Tom That name is too short, it must be between 4 and 10 characters. Checking the Start / End of a String To determine if the first character in a string is a specific value use the .startswith() command. .startswith() is a function that will return True or False . Below is an example program to check if a name begins with the letter L . name = input ( "Enter a name: " ) if name.startswith( "L" ) == True : print ( "I like that name." ) else : print ( "I don't like that name." ) Enter a name: Lionel I like that name. Enter a name: Katjaa I don't like that name. Similarly, you can use .endswith() to check the last characters of a string . Practice Task 4 Ask the user to enter a country. Print a message if it ends with 'land', 'stan' or any other ending. Use .endswith() Example solution: Enter a country: Finland You have entered a 'land' country. There are 9 in the world. Enter a country: Kyrgyzstan You have entered a 'stan' country. There are 7 in the world. Enter a country: Peru Thanks for your entry. Note: You don't need to check if it's a valid country. Reversing a String To reverse a string, you write the variable name and then use square brackets to move one character at a time backwards. The first two colons are left empty as they denote where to start and end from (which don’t need to be changed). Therefore the -1 states that it will reverse from the end to the start : Ask the user to enter a random sentence. Print the sentence in reverse. Example solution: Practice Task 5 Printing Parts of a String You may want to print just part of a string or variable using square brackets. You can also use len to work out the length and work back, if you want to display the last characters: Practice Task 6 Ask the user to input a long word. Output the middle character of the word. Example solution: Split Strings Use the .split command to split a string into separate words . An empty split command such as words.split() will split at each space . You can enter a value in the brackets to split at certain characters , such as words.split(",") Use the len function to count the number of words once they have been split. You can use a for loop to cycle through each word. The program below checks the length of each word . Practice Task 7 Ask the user to input a sentence. Calculate and print the amount of words in the sentence. Calculate and print the amount of words that begin with s. Example solution: ⬅ Section 8 Practice Tasks 9b - Number Handling ➡
- Python | 10b - Read & Search Files | CSNewbs
Learn how to read and search through files in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. Python 10b - Read & Search Files Reading from a File To read and print from a file you must open it in read mode by typing "r" instead of "a". If you are writing and reading in the same program, make sure you close the file in append mode before you open it in read mode . The program below uses the Customers.txt file from the last section. A simple for loop can be used to print each line of the file. The end = "" code just prevents a space between each line. Practice Task 1 Open one of the files that you used in Section 10a and print each line. Example solution: Reading Specific Lines from a File Sometimes it is necessary only to print certain lines. The following example uses a file where I have written a sentence of advice on each line. The user is asked to enter a number between 1 and 6. If they enter 1, the first line of the file is printed. If they enter 2, the second line of the file is printed etc. Remember Python starts counting everything at 0 so each line is a digit less than you would expect . Square brackets must be used to denote the line to print: [1] not (1). The end = "" code is not necessary but removes space after the line. Practice Task 2 Create a text file (saved in the same folder as your Python file) with a list of video games. Ask the user to enter a number between 1 and 10. Print the line for the number that they input. Example solution: Print a Random Line The randint command can be imported and used to print a random line from a file . The example below prints one of the 12 months . The file is opened in read mode and the readlines() command extracts each line , placing them in a list . A random number is then generated between 0 and one less than the total number of lines . This random number is then used to print a line from the extracted list of lines . Python code from random import randint file = open ( "months.txt" , "r" ) lines = file.readlines() random = randint(0,11) print (lines[random]) months.txt January February March April May June July August September October November December potential outputs March December April July If the length of the file is not fixed (e.g. new lines are being added or lines removed ) then the random number generation line can be adapted to use the len command to calculate the current number of lines . This is required to know the upper limit of the random number . random = randint(0,len(lines)-1) Searching Through Files A for loop is used to search through a file , line by line . First, an input line is used to allow the user to enter their search term . If the term that is being searched for is found, then the whole line is printed. The example below uses a variable named found to state if there is a match when the file is searched. If the search term is found, then the found variable is changed to true . If the search term is not found , the found variable remains as false, so the 'no customers found' statement is printed . Practice Task 3 You should have completed Practice Task 2 from Section 10a (the A Level task). Add extra code to that program so that you can search for specific students. Example solution: ⬅ 10a - Open & Write Files 10c - Remove & Edit Lines ➡









