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 16:10
An electrical motor raises a 50kg load at a construct velencity .calculate the power of the motor, if it takes 40sec to raise the load through a height of 24m(take g =9.8n/g)
Answers: 2
question
Engineering, 04.07.2019 18:10
Which one from below is not one of the reasons of planning failures? (clo3) a)-planner is careless. b-planner spend less time in the field but more time on the desk c)-planner is not qualified d)-planner does not have sufficient time to properly plan
Answers: 3
question
Engineering, 04.07.2019 18:20
Agas mixture consists of 8 kmol of h2 and 2 kmol of n2. determine the mass of each gas and the apparent gas constant of the mixture.
Answers: 3
You know the right answer?
Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers...
Questions
question
English, 18.03.2021 02:30
question
History, 18.03.2021 02:30
question
English, 18.03.2021 02:30
question
Geography, 18.03.2021 02:30
Questions on the website: 13722363