Computers and Technology

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 zthis 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 .

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:30, dnjames01
Given the following code: if (n == 2) { k -= 2; } else if (n == 3) { k -= 3; } can be rewritten as: if (< condition > ) { < assignment statement > ; } assume that evaluating < condition > does not change the values stored in n and k. which of the following could be used as < assignment statement > ? k -= n; k -= 1; k -= 2; k += n; k = n - k;
Answers: 2
image
Computers and Technology, 22.06.2019 07:00, Jasten
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
image
Computers and Technology, 22.06.2019 21:00, mazolethrin9632
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
image
Computers and Technology, 23.06.2019 03:30, patience233
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
Do you know the correct answer?
Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers...

Questions in other subjects: