Question: Im getting a error for value not defined , I cant figure out whats wrong with the code . This is for Python print() number=input(enter
Im getting a error for value not defined , I cant figure out whats wrong with the code . This is for Python
print()
number=input("enter a number=")
#sum of digits class
class sumofDigit(): def calculate(self,number):
#covert to a string
value=str(number)
sum = 0
# calc sum of three digit number
for each in value: sum=sum+int(each)
print()
print("sum three num into two number=",sum)
print()
# calc sum of two digit num
final= str(sum)
finalsum = 0
# loop
for each in final: finalsum = finalsum+int(each) print()
print("sum of two num into one num =",finalsum)
# create object and method
obj = sumofDigit()
obj.calculate(number)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
