0
Python
def filter_ints(word_list): Return a tuple containing two lists. The first list should contain an int for each element of the argument 11st that is a string that represents = valid integer. The second list should contain all the elements of the argument list that do not represent valid integers. 3 4 5 6 7 user-defined 1 def main(): Prompt the user to enter some integers, separated by blanks, output a list of the valid integers and the sun of these integers. If the list contains some "words" that are not valid integers, then output a list of these "error wards". If not, do not output a list of these "error words.
9 Answers
+ 1
Can you share your try?
Try it yourself first and share your attempt if not successful.
Also can you add a sample input with expected output..!
+ 1
Save code in playground and share link. Code output depends on indentation in Python . So it must.
edit:
Aakanksha Mourya
See your sample is cut off. Sample helps to fully understand the problem. I don't solve it.
I try to help to solve it, as much as possible by me..
+ 1
Ok
0
Can anyone help me in this question
0
Ok
0
Import re
def as integer can object):
Is interger_list = []
for x in an object:
if isinstance(x, str): check if the string is vall if str(x).count("-") True: if the valid string starts with (-) or has
sign remove resub, x) that character is stripped
if str(sign_remove).isnumeric() True: then check if this string is interger list.append(x)
is interger list.append("one") 1 str(x).isnumeric()= True: the check if this string is a number
is interger 11st.append()
else: is interger list.append("None")
return is interger 1st
def main():
element list 11
element_list=list(nap(str, input(),strip().split()))
verified integer list as integer (element_list)
for x in verified integer list:
main()
Code for above question which I have posted
0
def as integer(an_object): If the argument is e string that represents
a valid integer return that integer.
otherwise, return the Nonetype object.
def main():
call the 61 Integer Function for each
element in the list: 28, 18, len, true,
and output the result object on its own line
51,
-18",
"e1:
You must write a main program to test your functions but do not submit your main program. Just copy and paste
your two function definitions into the code box below.
Here is a sample of a main program that just calls the main function
20 None
-10
e
0
Can u solve this question ❓
0
I have to submit the assignment