File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ area topic
12
12
⚙ slice lists and strings
13
13
💡 use the ``join `` method of the ``string `` data type
14
14
🔀 use a loop variable for indexing
15
+ 🔀 use indexing to re-arrange a list
15
16
======= ====================================
16
17
17
18
@@ -110,3 +111,25 @@ Exercise 7: Decrypt
110
111
-------------------
111
112
112
113
Write a program to decrypt an encrypted message again.
114
+
115
+
116
+ Exercise 8: Encryption Key
117
+ --------------------------
118
+
119
+ Use an encryption key like ``2031 `` that specifies a new order for the blocks.
120
+ Implement the following:
121
+
122
+ 1. create an empty list
123
+ 2. create the blocks as above and add them to the list
124
+ 3. go through each position of the encryption key
125
+ 4. select the block with the index given by the digit from the key (convert it to int)
126
+ 5. add the block to the result string
127
+
128
+
129
+ Reflection questions
130
+ --------------------
131
+
132
+ - what is indexing?
133
+ - what do the three numbers in *slicing * do?
134
+ - what do you think about the transposition cipher. Is it secure?
135
+ - how could you decrypt a transposition cipher without the key?
You can’t perform that action at this time.
0 commit comments