File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ # exercise 1.2.5 from unit 1
2
+ '''
3
+ Reverse engineering, or reverse engineering (in English: Reverse engineering),
4
+ is the study of something by breaking it down into its components and learning how it works.
5
+ Today, reverse engineering is widely used in the world of computers, when studying computer code.
6
+
7
+ Here is a piece of code that asks the user to enter a password as input. The code checks whether
8
+ the entered password is correct (that is, meets certain conditions) or not and prints an
9
+ appropriate output to the screen.
10
+ '''
11
+
12
+ import functools
13
+ def function (num , item ):
14
+ return num + 1
15
+ password = input ("Enter Your password (integers only): " )
16
+ lst = list (map (int , password ))
17
+ magic = functools .reduce (function , lst )
18
+ result = (lambda x : x % 4 == 0 )(magic )
19
+ if result :
20
+ print ("Correct password!" )
21
+ else :
22
+ print ("Wrong password." )
23
+
24
+ # After you understand how the code works, choose from the following inputs the input for which
25
+ # the output will be printed: "!Correct password"
26
+ # Answer: 1234
You can’t perform that action at this time.
0 commit comments