This is essentially 2 questions I think.
- How do I make all internal functions use the same raw_input?
- How do I chain functions with that input?
I've been trying to make something that will make a circle shape with whatever character the user inputs. (This is a "for fun" activity that I thought up to help me get used to functions. I've only been self teaching Python for 2 weeks now)
So far my code is:
def circle(symbol):
def lines1(aa):
print(symbol * 20)
aa()
print(symbol * 20)
return(lines1)
def lines2(bb):
print(symbol * 7 + ' ' * 6 + symbol * 7)
bb()
print(symbol * 7 + ' ' * 6 + symbol * 7)
return(lines2)
def lines3(cc):
print(symbol * 4 + ' ' * 12 + symbol * 4)
cc()
print(symbol * 4 + ' ' * 12 + symbol * 4)
return(lines3)
def lines4(dd):
print(symbol * 2 + ' ' * 16 + symbol * 2)
dd()
print(symbol * 2 + ' ' * 16 + symbol * 2)
return(lines4)
def lines5():
print(symbol + ' ' * 18 + symbol)
print(symbol + ' ' * 18 + symbol)
return(lines5)
lines1(lines2(lines3(lines4(lines5()))))
circle(raw_input())
Example: If the user inputs a #, it is supposed to output:
####################
####### #######
#### ####
## ##
# #
# #
## ##
#### ####
####### #######
####################
The problem is it doesn't output anything.