subject
Engineering, 08.11.2019 20:31 dkh2021

Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers. write code that converts these to integers and print the sum of these three integers. however, if any variable has a value that cannot be converted to an integer, print out, the string "bad value(s) in: " followed by the names of the variables that have bad values (separated by spaces, in alphabetically ascending order).

for example, if the values of x, y and z were respectively "3", "9", "2" then the number 14 would be printed; but if the values were "abc", "15", "boo" then the output would be:

bad value(s) in: x z

this is what i have so far:

try:
print(int(x)+int(y)+int(z))
except valueerror:
if x=valueerror:
print("bad value(s) in: ", x)
elif y=valueerror:
print("bad value(s) in: ", y)
elif z=valueerror:
print("bad value(s) in: ", z)

python3 .

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 23:20
Two technicians are discussing the intake air temperature (iat) sensor. technician a says that the computer uses the iat sensor as a backup to the engine coolant temperature (ect) sensor. technician b says that the powertrain control module (pcm) will subtract the calculated amount of fuel if the air measures hot. who is correct
Answers: 3
question
Engineering, 04.07.2019 18:10
What difference(s) did you notice using a pneumatic circuit over hydraulic circuit.explain why the pneumatic piston stumbles when it hits an obstacle.
Answers: 2
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
You know the right answer?
Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers...
Questions
question
Mathematics, 26.09.2019 07:30
Questions on the website: 13722363