GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Part II: Code Interpretation and Analysis (20 Points) Instru…

Part II: Code Interpretation and Analysis (20 Points) Instructions: Read each code segment carefully. Answer all questions. Show your reasoning where appropriate.

Read Details

A university stores course enrollment using each student’s i…

A university stores course enrollment using each student’s identification number as the key. Which Python data structure is the most appropriate?

Read Details

Which NumPy capability allows mathematical functions to be a…

Which NumPy capability allows mathematical functions to be applied efficiently to every element of an array?

Read Details

Which file format is most commonly used for exchanging tabul…

Which file format is most commonly used for exchanging tabular datasets between different software applications?

Read Details

A software engineer studies an existing fraud detection syst…

A software engineer studies an existing fraud detection system and notices that many components can be reused when building a credit card fraud detector. Which computational thinking principle is primarily being applied?

Read Details

Write a function called good_market that receives no paramet…

Write a function called good_market that receives no parameters and randomly returns a number between 1 and 30, inclusive. Write another function called main that calls good_market. If the number returned is between 1-10 inclusive, return 0. If the number returned is between 11-20 inclusive, return the number. If the number returned is between 21-30 inclusive, return double the number. HINT: Make sure to import any modules you might need to use. Copy your answer into the textbox below.  

Read Details

Define a function named create_contacts that consumes two pa…

Define a function named create_contacts that consumes two parameters. The first parameter is a list of strings, representing names. The secondparameter is a list of strings, representing phone numbers. This function should return a dictionary where the keys are the names from the first list,and the values are the phone numbers from the second list. You can assume that the two lists will never be empty and that they will always contain the same number of key/value pairs. You cannot use the python zip tool. Do this the long way using a for-loop. Write 2 assert_equal tests. Each list should contain at least 2 key-value pairs. Sample Output print(create_contacts([‘luke’,’leia’],[‘435-123-4567′,’435-765-4321’]))-> {‘luke’:’435-123-4567′,’leia’:’435-765-4321′} The starting code in case the embedded IDE cannot be loaded for you. from cisc108 import assert_equal Copy your code into the canvas textbox. Code in the python editor is NOT saved.

Read Details

Write a Airplane class which keeps track of the number of pa…

Write a Airplane class which keeps track of the number of passengers in a plane. Write a constructor that receives the maximum number of passengers allowed in the plane as an integer and stores it as a data member. Create another data member to track the current number of passengers in the plane. It should start as 0. Write a method called add_passengers() which receives one additional parameter, the number of passengers to add to the plane. It adds that number to the current passenger count. If that number is greater than the maximum number of passengers allowed in the plane, set the current number to the maximum number of passengers . Write a method called utilization() which receives no additional parameters and returns a string using the following criteria: “bad” if the plane is less than 25% full; “ok” if the plane is between 25% and 75% inclusive; “awesome” if the plane is more than 75% full. HINT: percent is: current_passenger_count/max_count Sample run of Airplane class imported to this file (main.py): import airplanea = airplane.Airplane(100)a.add_passengers(15)print(a.utilization()) # bada.add_passengers(45)print(a.utilization()) # oka.add_passengers(60)print(a.utilization()) # awesome Copy your code airplane.py into the canvas textbox. Code in the python editor is NOT saved.

Read Details

Define a function named create_menu that consumes two parame…

Define a function named create_menu that consumes two parameters. The first parameter is a list of strings, representing the names of items on a menu. The secondparameter is a list of floats, representing the prices of the menu items. This function should return a dictionary where the keys are the menu item names from the first list,and the values are the menu item prices from the second list. You can assume that the two lists will never be empty and that they will always contain the same number of key/value pairs. You cannot use the python zip tool. Do this the long way using a for-loop. Write 2 assert_equal tests. Each list should contain at least 2 key-value pairs. Sample Output print(create_menu([‘cupcake’,’brownie’],[2.79,3.15]))-> {‘cupcake’:2.79,’brownie’:3.15} The starting code in case the embedded IDE cannot be loaded for you. from cisc108 import assert_equal Copy your code into the canvas textbox. Code in the python editor is NOT saved.

Read Details

China under Empress Wu Zhao

China under Empress Wu Zhao

Read Details

Posts pagination

Newer posts 1 … 18 19 20 21 22 … 92,476 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top