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]
3 years ago
11

Exercise 9.2.9: Strings To Integers5 points

Computers and Technology
1 answer:
netineya [11]3 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
Do not use the scanner class or any other user input request. You application should be self-contained and run without user inpu
nikitadnepr [17]
يتريرينييننيخيوويميمسكيك
6 0
3 years ago
Add definitions for the following keywords to your glossary of words.
lianna [129]

Answer:

wifi=a facility allowing computers, smartphones, or other devices to connect to the internet or communicate with one another wirelessly within a particular area.

bandwidth=a range of frequencies within a given band, in particular that used for transmitting a signal.

The bit is the most basic unit of information in computing and digital communications. The name is a contraction of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as either "1" or "0", but other representations such as true/false, yes/no, +/−, or on/off are commonly used.

A megabit is a unit of digital information with prefix mega (symbol M). And it is equal to one million bits. It also means 106 bits or 1,000,000 bits. ... The unit symbol of megabit is Mbit. You can convert megabit to other units of data using our tool.

The gigabit is a multiple of the unit bit for digital information or computer storage. ... 1 gigabit = 109bits = 1000000000bits. The gigabit has the unit symbol Gbit or Gb. Using the common byte size of 8 bits, 1 Gbit is equal to 125 megabytes (MB) or approximately 119 mebibytes (MiB).

The Emergency Broadband Benefit is an FCC program to help families and households struggling to afford internet. The Emergency Broadband Benefit is limited to one monthly service discount and one device discount per household.

Buffering is the process of preloading data into a reserved area of memory that's called a buffer. In the context of streaming video or audio, buffering is when the software downloads a certain amount of data before it begins playing the video or music.

5 0
3 years ago
Ask what kind of pet the user has. If they enter cat, print "Too bad...", if they enter dog, print "Lucky you!" (You can change
nirvana33 [79]

Answer:

Explanation:

a = input("what kind of pet the user has")

if a == 'cat':

  print("Too bad")

elif a == 'dog':

   print("Lucky you!")

8 0
3 years ago
There are over 150 free themes on Wordpress.com. Which of the following is a common feature for which you can filter your theme
Oduvanchick [21]

Answer:

A responsive layout is usually a common and important aspect of a theme since it can allow users to use different devices and receive a proper satisfactory visit.

Explanation:

Depending on the purpose of the site, you need to be decided what functionalities you deem necessary and which are just useful in case you might need it later on. Example

A blog site will required a good blog theme,

including one that has ecommerce options depends weather the blogger might be thinking of selling things or not.

8 0
3 years ago
Is this good enought to record and edit in 4k UHD? (Ultra High Definition)
vekshin1

Answer:

It should be, yes

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write a calculator program that keep reading operations and double numbers from user, and print the result based on the chosen o
    6·1 answer
  • Which of the following could be useful during system testing?
    6·1 answer
  • How globalization is related to communication technology?
    6·1 answer
  • How does kinetic energy affect the stopping distance of a vehicle traveling at 30 mph compared to the same vehicle traveling at
    6·1 answer
  • You can sort a large array of integers that are in the range 1 to 100 by using an array count of 100 items to count the number o
    9·1 answer
  • What does the word "e-business" mean?
    11·2 answers
  • What does "scanf(\"%d\" mean?
    13·2 answers
  • Rewrite the following program segment using a while loop instead of a for loop.
    11·1 answer
  • RTOS stands for ______ Time Operating System.
    11·1 answer
  • Which three characteristics help identify a business opportunity? (Choose three)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!