subject
Computers and Technology, 26.11.2019 06:31 rebtav

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 Computers and Technology

question
Computers and Technology, 24.06.2019 08:30
@josethesolis i need can anyone text me and follow me
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
question
Computers and Technology, 25.06.2019 05:00
Craig keeps missing important staff meetings and getting double-booked for appointments. craig should use scheduling software a database diagramming software a word processor
Answers: 1
You know the right answer?
Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers...
Questions
question
Mathematics, 17.01.2021 22:20
question
Mathematics, 17.01.2021 22:20
question
Mathematics, 17.01.2021 22:20
question
Mathematics, 17.01.2021 22:30
question
Physics, 17.01.2021 22:30
question
Mathematics, 17.01.2021 22:30
Questions on the website: 13722362