aqa text encryption

advertisement
Megan goatley Text Encryption wildern school
Unit 1practical
programming
Python
Scenario 4
Text
encryption
Page 1
Document1
Megan goatley Text Encryption wildern school
Content
Design of Solution (9 marks)




The problem
User Needs / Success Criteria
Overview Plan
Pseudo Code / Flowchart
Solution Development (Python Program) (9 marks)


With comments
Solution screenshots with text explaining what it does
Programming Techniques (36 marks)
1.
2.
3.
4.
5.
6.
Show an understanding of the techniques used
Show how the different parts work together
Show how the program works as intended
Show justification of the techniques used
Show the data structures used
Show how the program is robust
Testing & Evaluation (9 marks)


Test Table to test the success criteria
Show at least one re-test
Evaluation


Page 1
How well does it meet user need?
What else could you have done to improve the program?
Document1
Megan goatley Text Encryption wildern school

Could you have worked harder on this task?
Design of solution:
Problem:
The user is given cipher text that is encrypted. The user needs to decrypt the code
and find out the meaning of the message, the encryption uses a key to hide the
message’s meaning. The key has to be used to change the code and revert it back
to its original form.
The user is given a randomly generated key which they can use to decrypt the
contents of the text file given.
User’s needs:
-
basic main menu is shown by using if or else statements
open/read sample text.txt using print commands
program allows user to decrypt text using if and else statements
program allows user to encrypt text using if and else statements
allows user to exit the program from main menu
allows user to input filename
allows user to use an 8 character key
Overview plan:
The user will be welcomed into the program and menu options will be displayed for
them. The problem is to be solved by the user by decrypting the cipher text given to
them and encrypting the sample.txt file. This will revert the text into simple text which
the user can use to find the meaning of the message. The user has access to exit
the game anytime they are given the option in the menu. The user will use the 8
character key provided to them so they can work out the offset factor between the
cipher text and plain text. This is used to decrypt the code and find the meaning of
the hidden encrypted message.
Page 1
Document1
Megan goatley Text Encryption wildern school
Flowchart:
Page 1
Document1
Megan goatley Text Encryption wildern school
Solution development:
The user needs a basic main menu
is shown by using if or else
statements and this is how I have
met the user’s needs
Changes a number into a letter or
symbol from the ASCII table
Allows user to exit the program from
main menu
Prints the option
that the user chose from the menu
Program allows user to decrypt text
using if and else statements
Allows user to input
filename
Allows user to enter the text file that
they need which the program will open
it for them
I have met the user’s needs to
open/read sample text.txt using print
commands here
This is how the program allows the
user to encrypt text using if and else
statements
Page 1
Document1
Megan goatley Text Encryption wildern school
Programming techniques
Show an understanding of techniques used:
techniques
Print screen
Input()
Input: Using input() will tell the program to input
and store this information away until it is directed
by the user to do something about it
Print(): Using print() will tell the program to display
text to the user. The use of it in this program means
it will display the text to the user in a certain position
and order to create a menu screen for the user to
choose options from.
Print()
File.read(): file.read() is used to tell the program
that if there is a file that the user needs to have
opened it will open it when directed by the user.
File.read()
If: An if statement is used when there are multiple
options for the user to choose from.
If
Elif Elif is used after an if statement if there is more
than two options available to the user. Using elif then
the name of the option e.g. “selection ==2:” followed
by print() and then the name of the option given to
the user is the structure I used to create the menu.
Elif
Else: Else is used as the final statement after
giving the user multiple options. Using else will
mean that if the user enters anything other than
the options given, the program will present the
user with a message telling them what they
entered wasn’t valid and to enter something else.
Else
Int: int is used when you need to convert an input to
an integer. This is so that the program knows to use
the whole number, not just what the user has been
entered into the code.
Int
Import
Import: import is used to import modules so you
have access to more to use in your program e.g.
random
=
=: the = statement is used in the code to tell the
program what the text/ file chosen is equal to e.g.
in my coderange
the variable
“ascii
value”
set to
Range():
is used to
create
listsiscontaining
equal
“0”.
arithmetic progressions and is a function that is
often used in “for” loops.
Page 1
Document1
Megan goatley Text Encryption wildern school
Range()
Page 1
Document1
Megan goatley Text Encryption wildern school
How the different parts work together
Here the if, Elif and else statements work together because if
you use the elif statement when there’s multiple options, the
user can chose from them.
The use of an else statement is that if the users input is invalid,
the program can show a message telling the user to input
something else.
How the program has
been made robust
Testing and evaluation:
action
Test input
no.
Expected outcome Actual outcome
Action needed
3
Exit program
Exit program
None (program works fine)
4
Invalid selection
Invalid selection
None (can’t use options that aren’t a choice for user)
0.432
error
error
None (can only use whole numbers to get an answer)
Encrypt 1
message
2
1
Encrypt message
Encrypt message
None (program works fine)
1.1
error
error
None (program only excepts whole numbers)
3
5
Invalid selection
Invalid selection
None (can only chose from potions given)
Decrypt 1
message
2
5
Invalid selection
Exit
1
program
2
3
Page 1
Document1
Megan goatley Text Encryption wildern school
3
Evaluation:
Overall I think my program works because I have used functions and statements that make the program more advanced. Also, the structure of my code is useful and works
well with the structure of the menu that was created which suits the user’s needs. The program is robust because if the user enters an invalid option, the program will tell
them. Something that didn’t go very well was my code because there is not much to it and it is very simple and basic. Something I could improve to do is I need to show
more understanding of the techniques used in programming. If I were to do this controlled assessment again I would look into things I could do to get higher marks and
show a greater understanding of the coding and the problem itself. I would also simplify my wording but still show understanding in my work.
basic main menu is shown by using if or else statements a basic menu is shown by using if or else statements. These were used in
my coding to
open/read sample text.txt using print commands
program allows user to decrypt text using if and else statements
program allows user to encrypt text using if and else statements
allows user to exit the program from main menu
allows user to input filename
allows user to use an 8 character key
Page 1
Document1
Download