return to previous lines | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

return to previous lines

how to return to previous lines in a program?(do again some lines!)

14th May 2018, 7:09 PM
mohamadhosein arasteh
mohamadhosein arasteh - avatar
1 Answer
0
That is where you should use a function. Write the lines in a function and call the function as many times as you need it. example: def f(x,y): print("I am reusing these lines") print(x*y) print(x+y) print(x**y) f(2,3) f(3,4)
14th May 2018, 7:55 PM
davy hermans
davy hermans - avatar