subject

I need help with my code because it keeps saying that I should replace the non-integer values with 0. # Write your function here...

list_of_strings = ["a", "2", "7", "zebra"]

# Your code here...
def safe_int(x):
try:
return int(x)
except ValueError:
return 0
print[safe_int(x) for x in range in list_of_strings]

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
You know the right answer?
I need help with my code because it keeps saying that I should replace the non-integer values with 0...
Questions
question
Mathematics, 29.04.2021 16:00
question
Mathematics, 29.04.2021 16:00
question
Mathematics, 29.04.2021 16:00
question
Mathematics, 29.04.2021 16:00
question
Geography, 29.04.2021 16:00
question
Mathematics, 29.04.2021 16:00
question
Mathematics, 29.04.2021 16:00