0
Python code to human language
From my experience I’ve observed that I will never know how to write a line of code without understanding what each piece of code is doing. To be available to write something, you should be available first of all to make translation from Phyton to Human Language and revers. So, I invite all the coders to contribute here and to help others to learn a new language – Python. For example: Python: x=2 y=6 if x > y: print ("X is greater than Y") else: print ("Y is greater than X") Human Language: Suppose we have the variable X with the value 2 and variable Y with the value 6. If the value of X is greater than the value of Y, print the message "X is greater than Y", else, print the message "Y is greater than X".
1 Odpowiedź
0
How many numbers will this code output?
Python:
n1 = 5
n2 = 13
while n2>n1:
print(n2)
n2-=2
Human Language:
Variable n1 = 5 and variable n2 =13
13 is greater than 5? Yes.
Print 13
n2 = 13-2
11 is greater than 5? Yes.
Print 11
n2 = 11-2
9 is greater than 5? Yes.
Print 9
n2 = 9-2
7 is greater than 5? Yes.
Print 7
n2 = 7-2
5 is greater than 5? No.