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
Which magazine introduced the first microcomputer kit for the mits altair in its january 1975 issue?
Tcecarenko [31]

Answer:

Popular Electronics  is the correct answer.

Explanation:

It is the first magazine that released in the year 1975, Jan. The following magazine is about the initial microcomputer kit which for the Mits Altair.

So, that's why the following answer is not false because it is the first magazine that released the article about the following microcomputer kit that is update on the cover of the magazine.

6 0
3 years ago
Please help im not good at computer class ​
Veronika [31]

Answer:

W.

Explanation:

4 0
3 years ago
Read 2 more answers
How do you fix this windows 7 screen​
tensa zangetsu [6.8K]

Try restarting it. If you can’t restart because the screen is frozen maybe just turn it off and back on. If you already tried restarting and it still didn’t fix the problem, just give it some time. The computer will reset itself eventually which should fix the problem.

6 0
3 years ago
Need help developing code!!
Alexxandr [17]
If you are just starting go on khan academy and go to the computing section and they will start you out on the basics on code devoloping. 
4 0
3 years ago
Zach follows the instructions that show him how to create a custom Web site in his school's learning management system. These st
NNADVOKAT [17]

Answer:

The answer is "Procedure"

Explanation:

In the given statement certain information is missing, that is choices, which can be described as follows:

a. procedure

b. software

c. data

d. hardware

e. memory

The procedure is a way, that accomplishes any task in the following steps, if there is a long process so, we divide this process into parts or modules to accomplish the task, and  certain alternative was wrong, that can be described as  follows:

  • Software is a program, that is accomplished in the procedure.
  • data, It describes all procedures.
  • hardware, It is a device, in which we work.
  • memory, It stores all the data in a procedure.    
3 0
3 years ago
Other questions:
  • Programmers insert documentation called facts into the program code.? <br> a. True <br> b. False
    9·1 answer
  • A nonpipelined system takes 300ns to process a task. The same task can be processed in a 5-segment pipeline with a clock cycle o
    10·1 answer
  • In the formula "=A3/B3", what part of the formula is the "/"?<br><br> A)An operator<br> B)An operand
    5·2 answers
  • Create a program that finds (n+1)! -factorial- of an integer n in C++.
    13·1 answer
  • An EULA usually takes the form of an electronic notification that appears when installing software. The user then has a choice t
    14·1 answer
  • GUYS THERE IS A HACKER IN BRAINLY PLEASE DONT PRESS ON THE WEBSITE THEY WILL HACK YOU.
    9·2 answers
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
  • What are some examples of productions categorized as non-broadcast productions?
    6·1 answer
  • What is a personal data?
    12·1 answer
  • How do i stop my computer from automatically connecting to a wireless network
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!