Skip to content

Commit e4f13fc

Browse files
authored
Merge pull request #18 from lironmiz/unit1-Ex1.2.5
Create unit1_ex1.2.5.py
2 parents be762e7 + 138d65a commit e4f13fc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

unit1_ex1.2.5.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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

0 commit comments

Comments
 (0)