def mainloop():
s = getinput()
while len(s)>0:
dosomething(s)
s = getinput()Assume that the getinput function just reads a line of input and puts the contents into s and assume that the dosomething function just prints its string argument.
What happens if the last two lines of the mainloop function were swapped? Would there be any difference?
I tried to get the mainloop() working without swapping the two lines first
def getinput(n):
s = n
def dosomething(s):
print s
def mainloop():
s = getinput()
while len(s)>0:
s = getinput()
do_something(s)
But i seem to get this error:
TypeError: mainloop() takes no arguments (1 given)
Some help would be appreciated