Question
Scenario Given a list, an array, or other data structure that includes a number of different data types, you want to be able to filter
Scenario
Given a list, an array, or other data structure that includes a number of different data types, you want to be able to filter out all of the integers and give an output of the remaining bits of data.
Aim
Write a function that receives a number of arguments; using a continue statement, skip integers and print out all other values.
Steps for Completion
-
Define a function named skip_integers, with a variable number of arguments.
-
Use a for loop to iterate over the arguments.
-
Use a check to see whether the value passed is of the integer type. If it is, use the continue statement to ignore it.
-
Print the arguments.
The output should be as shown in Snippet 4.30:
5.2 value 6.0Lab Activity 4.3: Function Arguments Function Arguments 11 Scenario Given a list, an array, or other data structure that includes a number of different data types, you want to be able to filter out all of the integers and give an output of the remaining bits of data. main.py + 1 def skip_integers (*k): 2 for i in k: 3 if isinstance(i,int):#check if it is integer 4 continue 5 else: 6 print(i) 7 8 skip_integers(3,5.2,"value", 6.0)#call function 9 Aim Write a function that receives a number of arguments; using a continue statement, skip integers and print out all other values. Steps for Completion 1. Define a function named skip_integers, with a variable number of arguments. 2. Use a for loop to iterate over the arguments. 3. Use a check to see whether the value passed is of the integer type. If it is, use the continue statement to ignore it. 4. Print the arguments. The output should be as shown in Snippet 4.30: 5.2 value 6.0 Snippet 4.30
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started