Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago