Message6400
DEFINE 'print_doof' BEFORE ASSIGNING IT TO f
#def beliebige_funktion(): define function f here
# f = beliebige_funktion assign function f to f
#Test
def print_doof():
print('doof')
f=print_doof()
mach_n(f,6)
REREAD THE CODE CAREFULLY
RUN MODULE
RESTART: C:\Users\Henrike
Schwenn\Roaming\Programs\Python\Python36\eigene Funktionen\rekursive
Funktionen\mach_n mit Funktionsobjekt.py
doof
>>>
RESULT: RETUNRS 'doof' JUST ONCE
ERROR MESSAGE: NONE
-> TYPE: SEMANTICS/LOCIC
BUG DESCRIPTION:
PYTHON DOESN'T SEEM TO REALIZE IT'S SUPPOSED TO REPEAT mach_n(f,n) UNTIL n=0
-> THERE MUST BE SOMETHING WRONG WITH
def mach_n(f,n):
if n <= 0:
return
else:
f
mach_n(f,n-1)
THAT IS NOT A SYNTAX ERROR
PYTHON MUST HAVE UNDERSTOOD THE FOLLOWING PART OF THE DEFINITION
def mach_n(f,n):
if n <= 0:
return
else:
f
CORRECTLY, OTHERWISE IT COULDN'T HAVE RETURNED F
-> THE PROBLEM MUST BE LOCATED IN THE LAST LINE OF THE BODY
mach_n(f,n-1) |
|
Date |
User |
Action |
Args |
2019-03-15 11:03:08 | When in trouble, go to the library | set | messageid: <1552647788.93.0.370558287966.issue2551031@roundup.psfhosted.org> |
2019-03-15 11:03:08 | When in trouble, go to the library | set | recipients:
+ When in trouble, go to the library |
2019-03-15 11:03:08 | When in trouble, go to the library | link | issue2551031 messages |
2019-03-15 11:03:08 | When in trouble, go to the library | create | |
|