(Apr-28-2021, 01:28 PM)snippsat Wrote: If run as script.py
file and not in REPL then there is no>>>
.
import random def rand(): for i in range(6): print(random.randint(1, 40)) rand()if it's longer code with functions it can be better to run it as a script.
Output:22 35 8 12 21 29
In REPL it would be like this.
>>> import random >>> >>> def rand(): for i in range(6): print(random.randint(1, 40)) >>> rand() 22 2 12 14 29 26 >>>
Perfect, many thanks!!