Python doubts errors

def get_input(‘10’,‘20’):
# Only edit the code segment between the dashes

# ------------------------------------

a = input("Enter number one: 10 ")
b = input("Enter number two: 20 ")

# ------------------------------------

print (a+b)

do you mean something like this,

def get_input():
  a = input("Enter number one: ")
  b = input("Enter number two: ")
  print (a+b) # or return (a + b)

Hello, @uma, and welcome to Python Software Foundation Discourse!

Without information regarding what you are trying to do, we can only guess.

My guess is that it is something similar to this:

def get_input():
  a = int(input("Enter number one: "))
  b = int(input("Enter number two: "))
  return a, b

x, y = get_input()
print(x + y)

Output:

Enter number one: 55
Enter number two: 89
144

If that is not it, please advise us, so we can offer effective help.

I am a biginer for python Please help me to solve this python coad problem
/def get_input():
# Only edit the code segment between the dashes

# ------------------------------------

a = input("Enter number one: ")
b = input("Enter number two: ")

# ------------------------------------

print (a+b)

thanks

What you fail to understand is that the Python input() function returns a string object, by default.

So, you either need to do on-the-fly type conversions on the inputs…

a = int(input("Enter number one: "))
b = int(input("Enter number two: "))

… or on the output…

print (int(a)+int(b))

That’s assuming you want integer numbers. For floating point numbers, use the float() conversion, as opposed to the int() conversion that I’ve used in the above.


edit to add…

You can see this in operation, if you have a print() function that returns the object ‘type’, as in print(type(a)) or print(type(b)), after the inputs have been executed.

Thanks Rob for your support, I entered the code, to the lesson, that I learn it didn’t work, sorry