Python | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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.

17th Nov 2022, 2:59 PM
Aakanksha Mourya
9 Antworten
+ 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..!
17th Nov 2022, 3:18 PM
Jayakrishna 🇮🇳
+ 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..
17th Nov 2022, 3:36 PM
Jayakrishna 🇮🇳
+ 1
Ok
17th Nov 2022, 4:01 PM
Aakanksha Mourya
0
Can anyone help me in this question
17th Nov 2022, 3:00 PM
Aakanksha Mourya
0
Ok
17th Nov 2022, 3:20 PM
Aakanksha Mourya
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
17th Nov 2022, 3:23 PM
Aakanksha Mourya
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
17th Nov 2022, 3:24 PM
Aakanksha Mourya
0
Can u solve this question ❓
17th Nov 2022, 3:35 PM
Aakanksha Mourya
0
I have to submit the assignment
17th Nov 2022, 3:35 PM
Aakanksha Mourya