Aw: Re: Re: Re: stuck on time

Python python at python.invalid
Sun Dec 8 09:32:02 EST 2019


RobH wrote:
> On 08/12/2019 13:06, Karsten Hilbert wrote:
>>>>> In an interactive interpreter:
>>>>>
>>>>> def print_time():
>>>>>       current_time = time.strftime("%I:%M")
>>>>
>>>> What happens if you then do
>>>>
>>>> print_time()
>>>>
>>>
>>> print_time()
>>> on it's own returns NameError: name 'print_time' is not defined
>>
>> Notice the "then" above ?
>>
>> More precisely: directly one after the other without leaving the 
>> interpreter ...
>>
>> Karsten
>>
> I'm not sure what you mean.
> 
> Like this?
>  >>>print_time()
> Traceback (most recent call last)
> File "stdin>", line 1, in <module>
> File "stdin>", line 2, in print_time
> File "stdin>", line 2, in print_time
> File "stdin>", line 2, in print_time
> [Previous line  repeated 996 more times]
> RecursionError: maximum recursion depth excedded.
> 
> Running the code in a shell , it is displaying the time and now also the 
> date .
> Nothing else tho', as in no rectangle drawn

Well... Maybe it's time to admit, Rob, that programming is not
your thing.




More information about the Python-list mailing list