Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Commonmark migration
Source Link

I'm trying to solve this problem:

Enter two numbers from keyboard with at least three digits.

Print the number that have the digits sum greater.

Inside of a function I have tried to print the values of variables. The values of those variables is not printed, so I think that the function is not being executed.

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var

I'm trying to solve this problem:

Enter two numbers from keyboard with at least three digits.

Print the number that have the digits sum greater.

Inside of a function I have tried to print the values of variables. The values of those variables is not printed, so I think that the function is not being executed.

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var

I'm trying to solve this problem:

Enter two numbers from keyboard with at least three digits.

Print the number that have the digits sum greater.

Inside of a function I have tried to print the values of variables. The values of those variables is not printed, so I think that the function is not being executed.

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var
deleted 183 characters in body
Source Link
Chris Martin
  • 30.9k
  • 12
  • 83
  • 142

I am beginner in Python programming and because of that i need some help.

I tryI'm trying to resolve a simplesolve this problem. Enter two numbers from keyboard with at least three digits. Print the number that have the digits sum greater.:

Enter two numbers from keyboard with at least three digits.

Print the number that have the digits sum greater.

In the title i said that the "function is not executed". I said that because insideInside of a function iI have tried to print the values of variables. The values of those variables is not printed, so iI think that the function is not being executed.

Thank in advance.

And my code is :

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var

I am beginner in Python programming and because of that i need some help.

I try to resolve a simple problem. Enter two numbers from keyboard with at least three digits. Print the number that have the digits sum greater.

In the title i said that the "function is not executed". I said that because inside of function i have tried to print the values of variables. The values of those variables is not printed, so i think that the function is not executed.

Thank in advance.

And my code is :

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var

I'm trying to solve this problem:

Enter two numbers from keyboard with at least three digits.

Print the number that have the digits sum greater.

Inside of a function I have tried to print the values of variables. The values of those variables is not printed, so I think that the function is not being executed.

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var
Source Link
user6221422
user6221422

My function doesn't execute

I am beginner in Python programming and because of that i need some help.

I try to resolve a simple problem. Enter two numbers from keyboard with at least three digits. Print the number that have the digits sum greater.

In the title i said that the "function is not executed". I said that because inside of function i have tried to print the values of variables. The values of those variables is not printed, so i think that the function is not executed.

Thank in advance.

And my code is :

a = input('\n Enter the first number : ' )
x = sum([a])
print('\n The sum of the digits number ' +str(x)+ ' este : %d' %x)
b = input('\n Enter the second number : ')
y = sum([b])
print('\n The sum of the digits number ' +str(y)+ ' este : %d' %y)
def sum(param):
 var = 0
 while(param != 0):
 var += (param % 10)
 print(var)
 param /= 10
 print(param)
 return var
lang-py

AltStyle によって変換されたページ (->オリジナル) /