Issue 2551028
Created on 2019-03-08 10:51 by When in trouble, go to the library, last changed 2019-03-26 19:47 by schlatterbeck.
msg6377 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-08 11:04 |
|
Task: Document each step of debugging mach_n.
Goals:
1. Keep track of solutions that didn't work out, avoid repeating the
same mistakes over and over.
2. Rule out types of bugs.
3. Keep track of my own learning process in programming and debugging.
3.1. What kinds of bugs are most frequent in my scripts?
3.2. How many steps does it take to fix them?
|
msg6378 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-08 11:07 |
|
'''Um mögliche Fehlerquellen bei mach_n auszuschließen, wird die
Funktion print_n (s,n) von Downey, S.58 unverändert eingegeben.
Diese Funktion gibt einen String n-mal aus.'''
def print_n(s,n):
if n <=0:
return
print s
print_(s,n-1)
print_n(s,n)
|
msg6379 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-08 11:14 |
|
'''Um mögliche Fehlerquellen bei mach_n auszuschließen, wird die
Funktion print_n (s,n) von Downey, S.58 unverändert eingegeben.
Diese Funktion gibt einen String n-mal aus.'''
def print_n(s,n):
if n <=0:
return
print s
print_(s,n-1)
print_n(s,n)
message:Missing parentheses in call to 'print'. Did you mean print(s)?
type: syntax error
|
msg6380 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-08 11:20 |
|
PUTTING PARENTHESES AROUND S
def print_n(s,n):
if n <=0:
return
print (s)
print_(s,n-1)
print_n(s,n)
RUN MODULE
RESTART: C:/Users/Henrike
Schwenn/Roaming/Programs/Python/Python36/eigene Funktionen/rekursive
Funktionen/Test print_n(s,n) - Downey S. 58.py
Traceback (most recent call last):
File "C:/Users/Henrike Schwenn/Roaming/Programs/Python/Python36/eigene
Funktionen/rekursive Funktionen/Test print_n(s,n) - Downey S. 58.py",
line 11, in <module>
print_n(s,n)
NameError: name 's' is not defined
>>>
TYPE: SYNTAX
|
msg6392 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-15 10:01 |
|
DEFINE S BEFORE RUNNING MODULE
'''Um mögliche Fehlerquellen bei mach_n auszuschließen, wird die
Funktion print_n (s,n) von Downey, S.58 unverändert eingegeben.
Diese Funktion gibt einen String n-mal aus.'''
def print_n(s,n):
if n <=0:
return
print (s)
print_(s,n-1)
s='beliebiger_string' #Platzhalter für die Definition von s
print_n(s,n)
RUN MODULE
RESTART: C:\Users\Henrike
Schwenn\Roaming\Programs\Python\Python36\eigene Funktionen\rekursive
Funktionen\Test print_n(s,n) - Downey S. 58.py
Traceback (most recent call last):
File "C:\Users\Henrike Schwenn\Roaming\Programs\Python\Python36\eigene
Funktionen\rekursive Funktionen\Test print_n(s,n) - Downey S. 58.py",
line 12, in <module>
print_n(s,n)
NameError: name 'n' is not defined
TYPE: SYNTAX
|
msg6393 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-15 10:03 |
|
INSERT 5 FOR n
def print_n(s,n):
if n <=0:
return
print (s)
print_(s,n-1)
s='beliebiger_string' #Platzhalter für die Definition von s
print_n(s,5)
RUN MODULE
RESTART: C:\Users\Henrike
Schwenn\Roaming\Programs\Python\Python36\eigene Funktionen\rekursive
Funktionen\Test print_n(s,n) - Downey S. 58.py
beliebiger_string
Traceback (most recent call last):
File "C:\Users\Henrike Schwenn\Roaming\Programs\Python\Python36\eigene
Funktionen\rekursive Funktionen\Test print_n(s,n) - Downey S. 58.py",
line 12, in <module>
print_n(s,5)
File "C:\Users\Henrike Schwenn\Roaming\Programs\Python\Python36\eigene
Funktionen\rekursive Funktionen\Test print_n(s,n) - Downey S. 58.py",
line 8, in print_n
print_(s,n-1)
NameError: name 'print_' is not defined
>>>
TYPE: SYNTAX
|
msg6394 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-15 10:06 |
|
ADD MISSING n IN print_(s,n-1)
def print_n(s,n):
if n <=0:
return
print (s)
print_n(s,n-1)
s='beliebiger_string' #Platzhalter für die Definition von s
print_n(s,5)
RUN MODULE
RESTART: C:\Users\Henrike
Schwenn\Roaming\Programs\Python\Python36\eigene Funktionen\rekursive
Funktionen\Test print_n(s,n) - Downey S. 58.py
beliebiger_string
beliebiger_string
beliebiger_string
beliebiger_string
beliebiger_string
>>>
IT'S WORKING! :)
|
msg6395 |
Author: [hidden] (When in trouble, go to the library) |
Date: 2019-03-15 10:09 |
|
CONCLUSION
NUMBER OF COMMENTS I NEEDED: 6
NUMBER OF SESSSIONS I NEEDED: 2
MAIN TYPE OF BUG: SYNTAX
TO KEEP IN MIND:
LOOK OUT FOR TYPOS
MAKE SURE TO DEFINE ARGUMENTS BEFORE PUTTING THEM INTO FUNCTIONS
|
|
Date |
User |
Action |
Args |
2019-03-26 19:47:36 | schlatterbeck | set | status: new -> closed resolution: invalid |
2019-03-15 10:10:57 | When in trouble, go to the library | set | nosy:
- When in trouble, go to the library versions:
+ devel, - 1.0 |
2019-03-15 10:09:54 | When in trouble, go to the library | set | messages:
+ msg6395 |
2019-03-15 10:06:32 | When in trouble, go to the library | set | messages:
+ msg6394 |
2019-03-15 10:03:51 | When in trouble, go to the library | set | messages:
+ msg6393 |
2019-03-15 10:01:16 | When in trouble, go to the library | set | type: resource usage messages:
+ msg6392 |
2019-03-08 11:20:19 | When in trouble, go to the library | set | messages:
+ msg6380 |
2019-03-08 11:14:00 | When in trouble, go to the library | set | messages:
+ msg6379 |
2019-03-08 11:07:29 | When in trouble, go to the library | set | messages:
+ msg6378 |
2019-03-08 11:04:52 | When in trouble, go to the library | set | nosy:
+ When in trouble, go to the library messages:
+ msg6377 |
2019-03-08 10:58:21 | When in trouble, go to the library | set | title: Fehler in mach_n finden -> find bug in mach_n |
2019-03-08 10:57:27 | When in trouble, go to the library | set | files:
- Stapeldiagramme rekursiver Funktionen.ods |
2019-03-08 10:57:05 | When in trouble, go to the library | set | files:
+ Stapeldiagramme rekursiver Funktionen.ods |
2019-03-08 10:56:40 | When in trouble, go to the library | set | files:
- mach_n mit Funktionsobjekt.py |
2019-03-08 10:56:32 | When in trouble, go to the library | set | files:
+ mach_n mit Funktionsobjekt.py type: behavior -> (no value) components:
+ Documentation, - None |
2019-03-08 10:55:58 | When in trouble, go to the library | set | files:
+ mach_n mit Funktionsobjekt.py |
2019-03-08 10:51:48 | When in trouble, go to the library | create | |
|