Help with functions!


#1

This function isn’t working! It’s supposed to ask the user for a number, and then add one to it and give the sum! It appears the raw_input command has an EOF error. Please tell me how to fix this:

print “Welcome to my add one program!”

n = raw_input(“Type a number to add one to it!”)

def add(n):
sum = n + 1
print "The sum of %s and 1 is " % (n) + str(sum)

add(n)


#2

Try setting n to an arbitrary number (like, 42) and comment out the input line; see if that lets you move on.