answer.
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
faust18 [17]
2 years ago
9

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

hese 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)
Computers and Technology
2 answers:
faust18 [17]2 years ago
6 0

Answer:

See explaination for the program code

Explanation:

Code below:

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))

zimovet [89]2 years ago
5 0

Answer:

Check the explanation

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
Enter an input statement using the input function at the shell prompt. When the prompt asks you for input, enter a number. Then,
Pavel [41]

Answer:

<u>Explanation:</u>

An input statement using the input function at the shell prompt is as follows:

If a prompt asks for a input, a number is to be added

num = input ('Number: ')

num = num + 1

print(num)

Explanation of results: This gives error at line num= num + 1 as cannot convert int object to str implicitly

8 0
2 years ago
Terry came into work and turned on his computer. During the boot process, the computer shut down. When he tried again, the compu
kirza4 [7]

Answer: Something to do with the storage device, in this case most likely a HDD.

Explanation: Operating System files has somehow probably gotten corrupted during the boot process, or the system drive connection to the motherboard have been severed.

7 0
2 years ago
What is the statement describing? Agile team continuously adapt to new circumstances and enhance the methods of value delivery
Vera_Pavlovna [14]

Answer:

Continuous Integration

Explanation:

In continuous integration process, A program or piece of code is edited, tested and validated by team of software developers or contributors to complete and deploy the single project. This practice will improve the quality and reliability of the code.

Improvement, delivery and deployment are the three different phases, to complete the process of continuous integration.The individuals who contribute in a code or program  in terms of improvement, delivery and deployment make a team that leads to continuous integration.

So, Agile team Continuously adapt Continuous Integration to new circumstances and enhance the methods of value delivery.

8 0
2 years ago
List any four routes of transmission of computer virus. <br>please give me answer​
JulijaS [17]

Opening attachments or links from unknown or spoofed emails. note: shown above are two examples of how viruses can often appear as legitimate messages, but are designed to trick the computer user. ...

Downloading software from malicious sites. ...

Online Ads. ...

Social media. ...

Unpatched software.

follow me

5 0
2 years ago
Which command suppresses the visibility of a particular Row or column in a worksheet?
leonid [27]

Answer:

Ctrl+Space is the keyboard shortcut to select an entire column.

Explanation:

When you press the Shift+Space shortcut the first time it will select the entire row within the Table.  Press Shift+Space a second time and it will select the entire row in the worksheet.

The same works for columns.  Ctrl+Space will select the column of data in the Table.  Pressing the keyboard shortcut a second time will include the column header of the Table in the selection.  Pressing Ctrl+Space a third time will select the entire column in the worksheet.

You can select multiple rows or columns by holding Shift and pressing the Arrow Keys multiple times.

4 0
2 years ago
Other questions:
  • Where is the Name Manager dialog box found?
    13·1 answer
  • Computer hardware had been designed to run a single operating system and a single app, leaving computers vastly underutilized. o
    15·1 answer
  • If the__________ is/are out of balance, the driver will feel a pounding or shaking through the steering wheel.
    7·2 answers
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • The spreadsheet below shows the names years in office, and number of terms for five US presidents
    7·2 answers
  • 1. Write the Python code needed to perform the following:2. Calculate state withholding tax (stateTax) at 6.5 percent3. Calculat
    9·1 answer
  • When TCP/IP translates a network layer address into a data link layer address, it sends a special ____________ to all computers
    15·2 answers
  • Drag each tile to the correct box.
    8·2 answers
  • Write a date transformer program using an if/elif/else statement to transform a numeric date in month/day format to an expanded
    14·1 answer
  • During the boot process, what does the processor do after the computer circuits receive power?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!