Views
1 week ago

Computing Academy GCSE Computer Science

This is what the output

This is what the output would look like if we were to type in the password incorrectly. Please enter your password 12345 Incorrect Password This is what the output would look like if we were to type in the password correctly. Please enter your password gh%yuN& Correct Password Not Equal To (!=) We could have written code to perform the same password check using the not equal (!=) comparison operator instead like this. userEntered = input(“Please enter your password”) actualPassword = “gh%yuN&” if userEntered != actualPassword: print(“Incorrect Password”) else: print(“Correct Password”) 193

Notice that we are now using the != operator in the if statement, so if userEntered is not equal to actualPassword we print the message Incorrect Password. If this is not the case and userEntered is equal to actualPassword we move to the else clause of our if statement and instead print the message Correct Password. Greater Than (>) We can use the greater than (>) operator to compare two value; a bank system, for example, might check to see if a customer has enough funds in their account to make a purchase. currentBalance = 50 purchasePrice = 200 if purchasePrice > currentBalance: else: print(“Not enough funds”) print(“You have enough funds”) Less Than (>) and Less Than or Equal To (>=) A company that buy second hand cars may only want to buy cars with less than 100,000 miles left on the odometer. The following code could compare a car’s milage with this limit. 194

Brookshear - Computer Science - An Overview 9e - Computarium LCD
COMPUTER SCIENCE
Computer Science @ Virginia Tech - Computer Science at Virginia ...
4/10/08 Backup and Recovery - Computer Science
DAY 14: ACCESS INTRODUCTION - Computer Science 101
Defensive Database Programming with SQL ... - Red Gate Software
The Oracle Academy Introduction to Computer Science
Read our Postgraduate Computer Science (MSc) booklet
Introduction to Computers and the Internet
Introduction to Computers and the Internet
National Academy of Sciences - PCIC Personal Computing Industry ...
1 - Department of Computer Science | University of Pittsburgh
Download eBook (PDF) - Red Gate Software
maps and algorithms - TAMU Computer Science Faculty Pages
CSE 114 – Computer Science I Lecture 1: Introduction
Future-Computer-Science-3
Planning and coding of problems for an electronic computing ...
Defensive Database Programming - Red Gate Software
Computer Science at IIT: Where Can It Take You? - Illinois Institute ...
COMPUTER SCIENCE - Jones & Bartlett Learning
COMPUTER SCIENCE PROGRAM - Polytechnic University
download - Department of Computer Science, Yonsei
Lecture 6 - Department of Computer Science
day 11: excel review microsoft access (intro) - Computer Science 101
CSCE 314 Programming Languages - TAMU Computer Science ...
Survey of Computer Science - Mathematics and Computer Science