Different output when i use function or directly, cant understand why | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Different output when i use function or directly, cant understand why

If i use it like this, output is always 0: (test3 is a button, lambda fun is called on click, test3) def fun(spawn): print(f"Reaction:{pygame.time.get_ticks()-spawn}") test3.random_click(event,lambda:fun(test3.spawntime)) But if i print it directly, its working normally (numbers are growing but nullified on click(cuz of spawntime is changing ) Full code: https://code.sololearn.com/ch0yG1XQhI5d

21st Jun 2022, 12:20 PM
Artur
Artur - avatar
2 Answers
+ 1
Maybe because print(f"Reaction:{pygame.time.get_ticks()-test3.spawntime}") has the wrong formating
21st Jun 2022, 12:31 PM
Abs Sh
Abs Sh - avatar
0
Whats wrong about this?
21st Jun 2022, 2:06 PM
Artur
Artur - avatar