Asked Mar 3, 2019

how to write a function in python 3 that take a tuple t = (7,8,4,20,11) and returns a list which includes all the numbers which are not a prime number. 


Expert Answer

Step 1

Note: The below program has been complied and executed in “” online complier

Step 2

Screenshot of the code:

Step 3

Editable code:


#definition of "not_prime" function
def not_prime(tup):

#declare the variable
arr = ()

#check the condition
for i in tup:

#check the condition
if i % 2 == 0:

#add the values into the tuple
arr += (i,)
# return the tuple
return arr

# definition of main function
if __name__ == "__main__":

#set the tuple
t = (7, 8, 4, 20, 11)
#call the fu...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in


Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add

Q: Question: Write a function to display a pattern as follows: 1 2       1 ... ... n       n-1         ...

A: Solution:The python program has the following algorithm:In the displayPattern() function,Declare and...


Q: What is the best way to pass 2D arrays to a function? (C++) For my program, I have a 2D array (size:...

A: There are two ways to pass 2-D array to a function either by sending the array name in the function ...


Q: Cell Phones Records In this part, you are required to write a program, using linked lists, that man...

A: In the given question, some parts of the question are missing to use linked lists.Here, I have creat...


Q: What is notepad ++ or notebad ? How to use it and what for ?It's required for my class The Web Stand...

A: We are explaining here the concept of notepad and notepad ++ and how and for what purpose these are ...


Q: 1. Write a complete Java program that prompts user for the number of floors in a hotel. Validate the...

A: Note: The given java program has been compiled and executed in "" online complier.


Q: Develop the ‘Shape’ application such that: Implement an array of objects of various types (all SIX ...

A: Program plan: Define a class called “Shape”.Define a default constructor to print the message.Define...


Q: How do I read a sequence of values in a file into a arraylist in a method? It's in java progarmming.

A: We need to use Scanner calss. In which java.util package used for obtaining the input of the primiti...


Q: Write a complete C++ program that randomly generates 20 integers between the rangeof 1 to 50 and sto...

A: The random number is generated by using rand() function from stdlib.h and in order to generate a new...


Q: How do you convert to binary format?

A: represents IP address in decimal format. In order to convert it into binary format we n...