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
IgorC [24]
2 years ago
11

Exercise 9.2.9: Strings To Integers5 points

Computers and Technology
1 answer:
netineya [11]2 years ago
5 0

Answer:

x=input("Enter a String")

def safe_int(x):

   #lis1=[ int(x)if x.isdigit() else 0 for x in list_of_strings]

   lis1=[]

   lis1=x.split()

   print(lis1)

   flag=0

   j=0

   while(j in range(len(lis1))):

       if(lis1[j].isdigit()):

           flag==0

       else:

           flag==1

           try:

               if(int(lis1[j])):

                   lis1[j]=int(lis[j])

               else:

                   flag==1

                   break

           except:

               print("Cannot convert to integer")

       j+=1

   print(lis1)    

   

   

safe_int(x)

Explanation:

We are taking as an input a sentence, and then splitting it into various list items, and storing them in a list. Now we try to convert each item to integer and using try-except print the message cannot convert if its not possible or else converts it. As a check. enter 0 2 7 0   and also try Hello World.

You might be interested in
Which of the following statements is true of licensing procedures for IT professionals?
melomori [17]

Answer:

the correct answer is b

Explanation:

4 0
3 years ago
Read 2 more answers
Urgent. I will mark you brainliest. explain why cyber warfare is a real threat.​
stellarik [79]

Answer: Cyber warfare is a real threat since being able to hack another computer especially a countries computer with lots of info in their weaknesses can lead to their downfall. Since they can even possibly if their skilled enough hack their entire data base system and leak it to the public and that wouldn't be good for them not in a single possible way. That's the reason it's dangerous not only that but also because they can access their servers; which can let them access anything online from the whole country including banking information military info which can let them know which area there gonna go to next equipment there gonna bring and where they're gonna launch missiles, bombs, even nukes if they decide to launch one. And being able to hijack the computer that launches the nukes can make the hacker launch the nuke to a different place or launch the nuke on the country trying to launch the nuke.

Explanation:

3 0
2 years ago
Read 2 more answers
Some problems are better solved by a computer and some are better solved by humans.
aalyn [17]

Answer:

I say when u don't know the answer completly.

3 0
2 years ago
The proxy statement issued by a corporation is a requirement of: a. The Securities & Exchange Commission (SEC) b. The Financ
8090 [49]

Answer:

The answer is "Option a".

Explanation:

A proxy statement is a file, that provides security and exchange in data commission, that is a powerful tool for holders, as it tells employees, that together with the instructions to do, and other choices, which could be listed as follows are wrong:

  • In option b, It is used in accounting guidelines, that's why it is wrong.
  • In option c, It requires, that's why it is incorrect.
  • In option d, It is wrong because it doesn't committee.
8 0
3 years ago
Given a high-level code you should be able to write the corresponding MIPS assembly code. Simple loop in C; A[ ] is an array of
nevsk [136]

Answer:

Explanation:

The code for the given problem is written below

.data

A : .word 1 2 3 4 5 6 7 8 9 10

.text

la $s5,A

li $s1,0 # load g

li $s2,10 # load h

li $s3,0 # load i

li $s4,1 # load j

loop:

mul $s6,$s3,4

add $s6,$s6,$s5 #address of A[i]

lw $s6,($s6) #get value of A[i] in s3

add $s1,$s1,$s6 #g = g+A[i]

add $s3,$s3,$s4 # i = i+j

bne $s3,$s2,loop #if i!=h jump to loop

4 0
2 years ago
Other questions:
  • 1. Which markup language adds the ability to use video without requiring the user to download add-ons?
    13·1 answer
  • What can you do to stop a computer from repeatedly restarting in a continuous loop?
    13·1 answer
  • Only class b and class c networks can be subnetted true or false
    6·1 answer
  • Mary is entering her senior year of college. She has a meeting on Friday with her advisor to discuss her career plans.Mary is al
    15·1 answer
  • I just got my driver's permit!!! However, it says I have 2 restrictions. What are the restrictions? Is it the not being allowed
    13·1 answer
  • Machines may aid in making work easier over a longer distance. true or false.
    7·1 answer
  • 3.
    5·1 answer
  • A security team has downloaded a public database of the largest collection of password dumps on the Internet. This collection co
    9·1 answer
  • WHAT TYPES OF ACTIVITIES ARE PERFORMED BY HEALTH CARE SOFTWARES
    8·1 answer
  • Which of the following expressions in Java is equal to 4?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!