Question: Need help on python value = 608 x = abs(int(str(value)[1])-int(str(value)[0])) y = abs(int(str(value)[1])-int(str(value)[2])) weight = x+y c = str(weight) print(That is + c)? My code

Need help on python

Need help on python value = 608 x = abs(int(str(value)[1])-int(str(value)[0])) y =

abs(int(str(value)[1])-int(str(value)[2])) weight = x+y c = str(weight) print("That is "+ c)? My

value = 608

x = abs(int(str(value)[1])-int(str(value)[0])) y = abs(int(str(value)[1])-int(str(value)[2]))

weight = x+y c = str(weight)

print("That is "+ c)?

My code got the right answer but

Do I have to use main(), for char in value, and for loop?

if i have to could you please show me how use those for this question ?

# The main() function starts the program # Display a description of the program's purpose # Prompt the user for a 3-digit CVN # Call the weight() function providing the 3-digit t CVN as an argument # The weight() function requires an integer parameter # Convert the Integer to a string # Initialize any necessary variables # setup a for loop that uses the digits as a sequence # sum the differences between each digit # Print the calculated weight of the Integer # Call the main() function

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!