1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dmitry_Shevchenko [17]
3 years ago
11

How to implement switch statement in Python?

Computers and Technology
2 answers:
gregori [183]3 years ago
8 0
Make sure there is a function/method to handle the default case. Next, make a dictionary object and store each of the function beginning with the 0th index. After that, write a switch() function accepting the day of the week as an argument.
Jet001 [13]3 years ago
5 0

Answer:

Switch-case statements are a powerful tool for control in programming. In this article, Sreeram Sceenivasan goes over you can use a switch-case statement in Python.

Explanation:

Python doesn’t need a switch statement. You can do exactly the same thing with if/elif/else statements.

You might be interested in
What is required for real-time surveillance of a suspects computer activity?/p Group of answer choices a. Blocking data transmis
Hitman42 [59]

Answer:

c  Preventing data transmissions between a suspect’s computer and a network server

Explanation:

3 0
3 years ago
Define the body of the function read_data(filename). If filename is None, return the sentence (already defined for your), otherw
Morgarella [4.7K]

Answer:

Answer explained

Explanation:

The main difference between parse_text_into_words( v1 and v2) is I have used splitlines also in v1 so the escape sequence '\n' will not be present in the list of words. while in v2 only split function is used so it will have '\n' present in words list.

Code:

def read_file(fileName = None):

  try:

      File = open(fileName,"r") # opening file in read mode

      for row in File:          # for each line in File

          print(row,end="")

  except IOError:      # handling exception of file opening

      print("Could not read file:",fileName)

def parse_text_into_words_v1(text):

  list_words = []

  list_lines = text.splitlines()

  for i in list_lines:

      list_words.extend(i.split(' '))

  return list_words

def parse_text_into_words_v2(text):

  list_words = []

  list_words.extend(text.split(' '))

  return list_words

def determine_difference(a_list,b_list):

  print("first list:",a_list)

  print("second list:",b_list)

  a_set = set(a_list)

  b_set = set(b_list)

  diff = a_set - b_set

  diff = list(diff)

  print("\nDifference between 2 sets: ",diff)

if __name__ == '__main__':

  print("Reading file using function read_file() to read \"data.txt\" :")

  read_file("data.txt")

  print("\n\n")

  t = '''vhfhyh ghgggj ghchvjhvj'''

  print("\nDemonstrating implementation of parse_text_into_words_v1:")

  l = parse_text_into_words_v1(t) # calling function with text parameter

  print("list of words:")

  print(l)

  print("\nDemonstrating implementation of parse_text_into_words_v2:")

  b = parse_text_into_words_v2(t) # calling function with text parameter

  print("list of words:")

  print(b)

  print("\nDemonstrating difference between two lists")

  a_list = [1,2,3,4,5,6,7,8,9,10]

  b_list = [2,4,6,8,10]

  determine_difference(a_list,b_list) # passing two list to take difference

8 0
3 years ago
What is a taskbar?
shutvik [7]
To me, the answer would be A menu that list options available in a particular program.
Because, It a list of instructions you can make your computer do like copy, paste, and print.
4 0
3 years ago
What Internet access method would be suitable for a business requiring a high bandwidth connection where no cabled options exist
34kurt

Answer:

Fiber Optic, it allows for speeds up to 1200 mbps

Explanation:

4 0
3 years ago
When using the red / yellow / green method to present status of a project, yellow can mean which of the following?
olga nikolaevna [1]

Answer:

Happiness is one of the obvious ones however I was not given any of the following so I am unsure as to what my options were.

Explanation:

the color is bright and is usually be thought to be the color of the sun which could give us happiness after a rainy day

8 0
3 years ago
Other questions:
  • Additional rows and columns are inserted into a table by using the _____ tab
    7·2 answers
  • In which section of a document would you include image acknowledgments for the images used ?
    8·2 answers
  • Computers store temporary Internet files in the Recycle Bin. These files take up space and slow down a computer. Which tool can
    10·1 answer
  • ∑_(A,B,C,D,E)▒〖(2,4,6,8,10,12,14,16,18,20,22,24,26,28,30)〗
    8·1 answer
  • Which category of software would programming languages fall into?
    8·2 answers
  • The File method lastModified() returns
    10·1 answer
  • Mention two hardware groups​
    7·1 answer
  • George enters the types of gases and the amount of gases emitted in two columns of an Excel sheet. Based on this data he creates
    6·1 answer
  • Assignment 2: room area <br>programming python in Project Stem​
    8·1 answer
  • Sebastian reads an online health news article that summarizes a new
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!