In a make task you write the program yourself, from an empty editor.
A bank vault system stores its daily override code in a secure text file called secret_code.txt. The file holds the code on its first line:
999
Write a program that:
secret_code.txt in read mode,999,Vault Unlocked if the code matches,Incorrect Code if it does not.The program asks the user nothing: everything it needs is in the file.
One line, which is either:
Vault Unlocked
or:
Incorrect Code
The code changes every day, so your program will not always find 999 in the
file. Each test puts a different secret_code.txt next to your program before
it runs, and the name of each test says what that file held. Some of those
files hold the right code and some do not, so both of your messages get
checked.
The code is compared as a number, so a file holding 0999 unlocks the vault
too, and only the first line of the file counts.
With 999 in secret_code.txt:
Output:
Vault Unlocked
With 123 in secret_code.txt:
Output:
Incorrect Code
To try your program before you submit it, use the To sandbox button at the
bottom of the editor. The sandbox comes with a secret_code.txt holding 999.
Change the number in it to see your other message.
Make sure that you check for the following things:
"secret_code.txt", spelled exactly like that..readline() reads just the first line, and has its brackets..close() comes straight after the reading, before the if.int() before it is compared. Without it, the line
read from the file is the text "999\n", which is never equal to 999.==, and 999 has no quotes around it.