Roundup Tracker - Issues

Issue 2551028

classification
Title: find bug in mach_n
Type: resource usage Severity: minor
Components: Documentation Versions: devel
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List:
Priority: Keywords:

Created on 2019-03-08 10:51 by When in trouble, go to the library, last changed 2019-03-26 19:47 by schlatterbeck.

Files
File name Uploaded Description Edit Remove
mach_n mit Funktionsobjekt.py When in trouble, go to the library, 2019-03-08 10:56
Messages
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
History
Date User Action Args
2019-03-26 19:47:36schlatterbecksetstatus: new -> closed
resolution: invalid
2019-03-15 10:10:57When in trouble, go to the librarysetnosy: - When in trouble, go to the library
versions: + devel, - 1.0
2019-03-15 10:09:54When in trouble, go to the librarysetmessages: + msg6395
2019-03-15 10:06:32When in trouble, go to the librarysetmessages: + msg6394
2019-03-15 10:03:51When in trouble, go to the librarysetmessages: + msg6393
2019-03-15 10:01:16When in trouble, go to the librarysettype: resource usage
messages: + msg6392
2019-03-08 11:20:19When in trouble, go to the librarysetmessages: + msg6380
2019-03-08 11:14:00When in trouble, go to the librarysetmessages: + msg6379
2019-03-08 11:07:29When in trouble, go to the librarysetmessages: + msg6378
2019-03-08 11:04:52When in trouble, go to the librarysetnosy: + When in trouble, go to the library
messages: + msg6377
2019-03-08 10:58:21When in trouble, go to the librarysettitle: Fehler in mach_n finden -> find bug in mach_n
2019-03-08 10:57:27When in trouble, go to the librarysetfiles: - Stapeldiagramme rekursiver Funktionen.ods
2019-03-08 10:57:05When in trouble, go to the librarysetfiles: + Stapeldiagramme rekursiver Funktionen.ods
2019-03-08 10:56:40When in trouble, go to the librarysetfiles: - mach_n mit Funktionsobjekt.py
2019-03-08 10:56:32When in trouble, go to the librarysetfiles: + mach_n mit Funktionsobjekt.py
type: behavior -> (no value)
components: + Documentation, - None
2019-03-08 10:55:58When in trouble, go to the librarysetfiles: + mach_n mit Funktionsobjekt.py
2019-03-08 10:51:48When in trouble, go to the librarycreate