Asked Oct 20, 2019

Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored in the list special_list = [-99, 0, or 44].


Expert Answer

Step 1

Python Program:

#Declare and initialize the variable

special_list = [-99, 0, 44]

#Prompt the user to give input

special_num = int(input("Enter special number: "))

#If condition to check whether the given input is in the list or not

if special_num in special_list:

  #Display the statement if the special

  #number is there in the special list.

  print("Special number")


  #Display the statement if the special

  #number is not there in the special list.

  print("Not special number")

Step 2

Output #1:

Enter special number: 44

Special number

Output #2:

Enter special numb...

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

Q: What part do people play in an information system?

A: Information SystemInformation systems (IS) refers to the combination of hardware and software that i...


Q: Create a time conversion program that prompts the user for a time in minutes. The program will conve...

A: Create a C++ program and inside the main method declare all required variables. And then take input ...


Q: The code you will need for this assignment is here (in C file)   /* YOUR NAME HERE* CSCI 4100* Progr...

A: C shell is type of command processor which enables the user to write and modify the commands.It can ...


Q: Write an application starting with ProjectTemplate. Name the class AgeCalcApp. The app needs to prom...

A: To write an application name ProjectTemplate with the class name AgeCalcApp. This application prompt...


Q: Annotate the following MIPS instructions to indicate source registersand destination registers. A so...

A: Annotations for the MIPS instructions mentioned in the question are given below-add $s1, $t2, $t3Add...


Q: Python 3.7.4: (Introductory Level) Write a program that requests a word (in lowercase letters) as in...

A: This problem must be answered in Python 3 of the version 3.7.4. According the question its clearly a...


Q: Python 3.7.4 Open the file hostdata.txt for reading.

A: To open the file hostdata.txt for reading, the statement is: f=open('hostdata.txt','r')The following...


Q: Python 3.7.4 Write the code to call the function named send_signal. There are no parameters for this...

A: To call the given function without parameter we need to write it as send_signal(). The following is ...


Q: Write a program (IN C++) that will present the user with a main menu of options which the user can c...

A: Click to see the answer