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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!