0

I'm creating a simple module that have a cin and cout functions. This will accept the user input and
display it afterwards.

Just like this:

text = napster.comein("Enter a number: ") 
napster.getout(text)

I have a problem in the function code because I'm an amateur in python programming.

This is my idea:

def comein(string):
    str = string
    string = input(string)

def getout(string):
    print string

What is the correct syntax in recalling the input of the user in the comein function?
I'm really confused about that.

3
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by nerdnapster
0

You need a return statement. Also, I deduce from your print statement that you're using python 2 where raw_input should be used instead of input, so it will be

def comein(string):
    return raw_input(string)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.