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]
4 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]4 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 the area on a machine where work is actually being performed and
zhenek [66]

Answer:

Point of operation guarding

Explanation:

Point of operation guarding. Point of operation is the area on a machine where work is actually performed upon the material being processed. The point of operation of machines whose operation exposes an employee to injury, shall be guarded.

5 0
3 years ago
All languages from the second generation on must be translated into machine language for the computer to be able process the inp
Stels [109]

Answer: Language translator

Explanation: Language translator is the tool that is used for the conversion of programming language into another in a operating system. It converts the initial language to machine language. With help of the source code , it translates the second generation language.If there are any occurrence of error , it automatically finds it and corrects it while being in the translating process.

5 0
3 years ago
If someone could translate this that would be awesome. I understand why you wouldn’t, it’s very long but I can’t do it without m
Angelina_Jolie [31]

Answer:

01010000 01010010

01001111 01001101

01001111 01000011

01001111 01000100

01000101 00111010

00100000 01000111

01101100 01101001

0111

100 0110001

0110111 01100011

this is the best i could do

Explanation:

5 0
3 years ago
can anyone sub to my youttube channel pls, its called Yakobu, and Im trying to reach 100 subs by the end of the month :)
allsm [11]

Answer:

Sure

Explanation:

3 0
3 years ago
This motherboard already has 1GB of RAM installed in the DIMM1 slot. The customerwould like to upgrade to 4GB total memory, use
Luden [163]

Answer:

The two phases to the context of this discussion are listed follows.

Explanation:

  • <u>Solution 1</u>: Delete 1 GB of current RAM as well as install another DIMM0 Chan A slot through one 2 GB of double-channel RAM. (thinkable unless the 2 GB RAM is provided by the motherboard in what seems like a DIMM0 Chan A slot)  
  • <u>Solution 2</u>: whether there's an unused or blank slot, perhaps one 1 GB dual-channel Ram could be mounted in some other slot at around the same speed or frequency.  

It's quite safer to mount memory with appropriate frequencies across both situations.

6 0
3 years ago
Other questions:
  • To evaluate trends in the workforce, investigate
    14·1 answer
  • Write a program that opens a text le called quiz.txt for reading. This le contains a single line with a student's rst name then
    15·1 answer
  • Which of the following mountain ranges stretches from Alabama to Canada?
    10·1 answer
  • Bushman and bonacci (2004) found that prejudiced participants were ____ likely to return a lost e-mail that had been addressed t
    5·1 answer
  • What are use class diagram, use case description and activity diagrams for use cases?
    7·1 answer
  • What is generalization error in terms of the SVM? a. How accurately the SVM can predict outcomes for unseen data b. How far the
    5·1 answer
  • Which actions changed the look of the following word?
    11·2 answers
  • can you follow my ikok? its that_enby_skye and my youube Cactus Face with 241 subscribe er s &amp; my twith Mx_Skye
    10·2 answers
  • Can someone help me with python
    10·1 answer
  • what statement about constructors is false? group of answer choices all constructors are passed a pointer argument constructors
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!