1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sladkih [1.3K]
3 years ago
7

Three variables, x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts th

ese 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
Computers and Technology
1 answer:
sineoko [7]3 years ago
5 0

Answer:

Required code is given below:

Explanation:

x, y, z = "abc", "15", "boo"

errors = []

try:

   x = int(x)

except ValueError:

   errors.append('x')

try:

   y = int(y)

except ValueError:

   errors.append('y')

try:

   z = int(z)

except ValueError:

   errors.append('z')

if len(errors) == 0:

   print(x+y+z)

else:

   print('bad value(s) in: ' + ' '.join(errors))

You might be interested in
What is ransomware<br>я​
Novosadov [1.4K]

Answer:

Ransomware is malicious software that infects your computer and displays messages demanding a fee to be paid in order for your system to work again. It has the ability to lock a computer screen or encrypt important, predetermined files with a password.

Explanation:

:)

5 0
2 years ago
Well I am having trouble and I feel really bad because I helped RandomGuy1 who rubs it in my face that I gave him the wrong answ
yawa3891 [41]
Hey dude don't leave tell a mod bout it they'll fix everything up for you.
8 0
3 years ago
Determine the value of X if (211) base x = (152) base 8, how to do this?
Alex
 we translate the following statement given in terms of logarithms. 211 base x can be expressed into log 211 / log x while 152 base 8 can be expressed int o log 152 over log 8. In this case,
log 211 / log x = log 152 / log 8log x = 0.962x = 10^0.962 = 9.1632
7 0
3 years ago
What function would you use to calculate the total interest paid for the first year of a mortgage?.
WITCHER [35]

Answer:

To calculate the total interest paid for the first year of a mortgage, the formula M = [P.r (1+r)n] / [(1+r)n-1] × 12 can be used.

Explanation:

3 0
2 years ago
1
Sergio [31]

Answer:

The answer to this question is given below in the explanation section

Explanation:

The ctrl+shift+e command is used to select track changes in a document.

Track Changes is a feature that is used in MS word or in wordprocessing application to track the changes inserted or modified by different users in a document. This helps the user to know where new text inserted or modified. Track changes help users to know new updates being inserted by other users in the document.

Furthermore, you can access the track changes features in the word file under the review tab. where you can find other related settings and features related to the track changes.

3 0
3 years ago
Other questions:
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • How can development in ICT be utilized to speed up the development and integration efforts
    15·1 answer
  • To select all the text in a document, press ____.
    12·2 answers
  • How to build an arch bridge​
    5·1 answer
  • In a system using the relocatable dynamic partitions scheme, given the following situation (and using decimal form): Job Q is lo
    5·1 answer
  • Michale spent 80 minutes at the libary he finished studying at 4:00 what time did michale start studying
    8·1 answer
  • 14. Convert 11110111 from binary to denary<br> (1 Point)
    12·2 answers
  • A function ________ contains the statements that make up the function.
    5·1 answer
  • Free brainliest!?! &lt;3​
    9·2 answers
  • Write a program to output 3 lines of text with the following information:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!