Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

. Write your own unique Python program that has a runtime error. Do not copy the program from your textbook or the Internet. Provide the following.

  • The code of your program.
  • Output demonstrating the runtime error, including the error message.
  • An explanation of the error message.
  • An explanation of how to fix the error.

Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.)

If the number is positive, the program should call countdown. If the number is negative, the program should call countup. Choose for yourself which function to call (countdown or countup) for input of zero.

Provide the following.

  • The code of your program.
  • Output for the following input: a positive number, a negative number, and zero.
  • An explanation of your choice for what to call for input of zero.

1. Copy the countdown function from Section 5.8 of your textbook.


def countdown(n):

   if n <= 0:

     print('Blastoff!')

   else:

     print(n)

     countdown(n-1)



Write a new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:

>>> countup(-3)

-3

-2

-1




Describe the difference between a chained conditional and a nested conditional. Give an example of each. 


Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give a example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. 



Implement your own version of the following Hash table in python language with mentioned functionalities: • Insert • Delete • Contains • Get Value by key • Size • Iterator • Traverse/Print

#1 Food Plate #1(wings)​​​$18

​#2 Food Plate #2 (chicken strips)​​12

​#3 Food Plate #3 (fish basket)​​12

​#4 Food Plate #4 (shrimp po boy)​​15

​#5 Food Plate #5 (pork chop basket)​​12

Write a program to ask customers to enter their first name and the menu item # they wish to purchase. The program should define a function to assign the price to the food item based on what the customer purchases. Call the function in the program to determine the cost of the food plate. for this program customers will only purchase one food plate. Then ask the customer if they would like to add a tip and how much. Add tax of 9% to the cost of the food item, add in the tip amount and display their total bill.  Do not include the tip when you calculate tax. The tip is extra after tax is charged on the food. Be sure to display a $ when displaying the total and 2 decimal

 


write a python program to count the number of uppercase and lowercase letters in the given word.


Write your own function that illustrates a feature that you learned in this unit . The function must take time at least one argument .


The media company "GlobalAd" has received a
batch of advertisements from different product
brands. The batch of advertisements is a
numeric value where each digit represents the
number of advertisements the media company
has received from different product brands.
Since the company banners permit only even
numbers of advertisements to be displayed, the
media company needs to know the total
number of advertisements it will be able to
display from the given batch.
Write an algorithm to calculate the total
number of advertisements that will be
displayed from the batch.
Input
The input consists of an integer batch,
representing the batch of advertisements
Output
Print an integer representing the total number
of advertisements that will be displayed by the
media company
Constraints
0 < batchs 109​
Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.

Example 2: Call your function from Example 1 three times with different kinds of arguments: a value, a variable, and an expression. Identify which kind of argument is which.

Example 3: Create a function with a local variable. Show what happens when you try to use that variable outside the function. Explain the results.

Example 4: Create a function that takes an argument. Give the function parameter a unique name. Show what happens when you try to use that parameter name outside the function. Explain the results.

Example 5: Show what happens when a variable defined outside a function has the same name as a local variable inside a function. Explain what happens to the value of each variable as the program runs.
LATEST TUTORIALS
APPROVED BY CLIENTS