Python Forum
[split] Something went wrong
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Something went wrong
#1
Hello all,

What is here wrong???
def repeat (symbol,n):
    res = ""
    while((n> 0)):
        res=(res+symbol)
        n=(n-1)
    return res
def draw_line (n):
    return repeat("*",n)
def draw_square(n):
    l=(draw_line(" ")+"\n")
    return repeat(res,n)
res=draw_square(3)
print (res)
The output must be:
"
Output:
*** *** ***
"
"rint (res)linerepeatdraw_line
Reply
#2
(Jan-04-2017, 10:01 PM)Student Wrote: Hello all,

What is here wrong???

1) you hijacked a thread that was completely unrelated
2) you didn't use code tags
3) you didn't say what the error you're getting is
4) draw_square() references an undefined variable, so it wouldn't run if anyone tried to help.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020