Forum Archive

Function does not give good result

sendog3c

Hi forum:

I need help to understand what is happening that the function does not give a good result.
Thanks.

import ui

suma = 0
suma1 = 0

class Arithmetic():
    pass

a = input("Vamos a Sumar. :")
type(suma)

def math_ope(a):
    return 2*a


resultado = math_ope(a)
print(resultado)
a = 0

mikael

@sendog3c, input returns a string. Convert the value with int() or float() before giving it to your function.

sendog3c

It works. Thank you very much