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, 21.06.2019 17:20
The liang book has an example called which is a javafx application that reads the javabook database using a preparedstatement object. using it as a guide, create a similar application called findbooks. it will read a list of authors from the bookdb created in problem 1 and display them in a listview. if the user selects an author, it should display the author's book titles in a textarea.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
question
Computers and Technology, 23.06.2019 13:10
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
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, 27.04.2020 02:28
question
History, 27.04.2020 02:28
question
Mathematics, 27.04.2020 02:28