This program exercise #4 wants the user to write a program in python that contains a list of movies titles, years and movie rating. You will need to display a menu option that allows the user to list all of the movies, add a movie, delete a movie and exit out of the program. This will be done using lists and the functions to add an element to a list and how to delete an element to a list. The program should be written utilizing functions in python for the main function, the display_menu function, the delete function, the add function and the list movie function. You can place this all in one python file or include them in various python files that include them into the main program. Let me know if you have any questions with this exercise. Output Screen: COMMAND MENU list - List all movies add - Add a movie del - Delete a movie exit - Exit program Command List: list 1. Monty Python and the Holy Grail, 1979, R 2. On the Waterfront, 1954, PG 3. Cat on a Hot Tim Roof, 1958, R Command: add Name: Gone with the Wind Year: 1939 Rating: PG Gone with the Wind was added.

Answers

Answer 1

Answer:

The program in Python is as follows:

def display_menu(titles,years,ratings):

   for i in range(len(titles)):

       print(str(i+1)+". "+titles[i]+", "+str(years[i])+", "+str(ratings[i]))

   

def delete(titles,years,ratings):

   del_item = input("Movie: ")

   if del_item in titles:

       print(del_item,"was deleted")

       index = titles.index(del_item)

       titles.pop(index)

       years.pop(index)

       ratings.pop(index)

   return(titles,years,ratings)

   

def add(titles,years,ratings):

   title = input("Title: ")

   year = int(input("Year: "))

   rating = int(input("Ratings: "))

   print(title,"was added")

   titles.append(title)

   years.append(year)

   ratings.append(rating)

   

   return(titles,years,ratings)

titles = []

years = []

ratings = []

print("COMMAND MENU list\nlist - List movies\nadd - Add movie del\ndel - Delete movie exit\nexit - Exit program")

menu = (input("Command List: "))

while(menu.lower() == "list" or menu.lower() == "add" or menu.lower() == "del"):

   if menu.lower() == "list":

       display_menu(titles,years,ratings)

   elif menu.lower() == "add":

       titles, years, ratings = add(titles,years,ratings)

   elif menu.lower() == "del":

       titles, years, ratings = delete(titles,years,ratings)

   menu = (input("Command List: "))

   elif menu.lower() == "exit":

       break

print("Exited!!!")

Explanation:

See attachment for complete program where comments are used to explain some lines of the program


Related Questions

A line beginning with a # will be transmitted to the programmer’s social media feed.

A.
True

B.
False

Answers

Answer:

True?

Explanation:

Answer:

The answer is false.

Explanation:

A “#” doesn’t do that in Python.

Which of the following is not the disadvantage of closed
network model?
Select one:
O Flexibility
O Public network connection
O Support
O External access​

Answers

Answer:

public network connection

Answer:

public network connection

You want a cable that could be used as a bus segment for your office network. The cable should also be able to support up to 100 devices. Which cable should you use?

A.
RG-6
B.
RG-8
C.
RG-58U
D.
RG-59

Answers

Answer: C

Explanation:

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

a) product = numA * numB
b) product = numA.multiply(numB)
c) product = numA.mul(numB

Answers

For multiplication one: product = numA * numB

For the addition: result = numA + numB

got 100 on this ez

(searched all over internet and no one had the answer lul hope this helps!)

Answer: First option: product = numA * numB

second option-numA + numB

Explanation:

Factory Design Pattern Assignment This assignment will give you practice in using the Factory/Abstract Factory Design Pattern. You are going to create a Terraforming program. What does terraform mean

Answers

Answer:

Terraform is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.

Write a MIPS assembly language program that prompts for a user to enter a series of floating point numbers and calls read_float to read in numbers and store them in an array only if the same number is not stored in the array yet. Then the program should display the array content on the console window.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. Here is one instruction that you might use:
c.eq.s $f2, $f4
bc1t Label1
Here if the value in the register $f2 is equals to the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT equals to the value in $f4, then it should be:
c.eq.s $f2, $f4
bc1f Label1
To load a single precision floating point number (instead of lw for an integer), you might use:
l.s $f12, 0($t0)
To store a single precision floating point number (instead of sw for an integer), you might use:
s.s $f12, 0($t0)
To assign a constant floating point number (instead of li for an integer), you might use:
li.s $f12, 123.45
To copy a floating point number from one register to another (instead of move for an integer), you might use:
mov.s $f10, $f12
The following shows the syscall numbers needed for this assignment.
System Call System Call System Call
Number Operation Description
2 print_float $v0 = 2, $f12 = float number to be printed
4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string
6 read_float $v0 = 6; user types a float number at keyboard; value is store in $f0
8 read_string $v0 = 8; user types string at keybd; addr of beginning of string is store in $a0; len in $a1
------------------------------------------
C program will ask a user to enter numbers and store them in an array
only if the same number is not in the array yet.
Then it prints out the result array content.
You need to write MIPS assembly code based on the following C code.
-------------------------------------------
void main( )
{
int arraysize = 10;
float array[arraysize];
int i, j, alreadyStored;
float num;
i = 0;
while (i < arraysize)
{
printf("Enter a number:\n");
//read an integer from a user input and store it in num1
scanf("%f", &num);
//check if the number is already stored in the array
alreadyStored = 0;
for (j = 0; j < i; j++)
{
if (array[j] == num)
{
alreadyStored = 1;
}
}
//Only if the same number is not in the array yet
if (alreadyStored == 0)
{
array[i] = num;
i++;
}
}
printf("The array contains the following:\n");
i = 0;
while (i < arraysize)
{
printf("%f\n", array[i]);
i++;
}
return;
}
Here are sample outputs (user input is in bold): -- note that you might get some rounding errors
Enter a number:
3
Enter a number:
54.4
Enter a number:
2
Enter a number:
5
Enter a number:
2
Enter a number:
-4
Enter a number:
5
Enter a number:
76
Enter a number:
-23
Enter a number:
43.53
Enter a number:
-43.53
Enter a number:
43.53
Enter a number:
65.43
The array contains the following:
3.00000000
54.40000153
2.00000000
5.00000000
-4.00000000
76.00000000
-23.00000000
43.52999878
-43.52999878
65.43000031

Answers

Explanation:

Here if the value in the register $f2 is equals to the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT equals to the value in $f4, then it should be

Create an application containing an array that stores eight integers. The application should call five methods that in turn:
Display all the integers
Display all the integers in reverse order
Display the sum of the integers
Display all values less than a limiting argument
Display all values that are higher than the calculated average value.
public class ArrayMethodDemo {
public static void main (String args[]) {
int[] numbers = {12, 15, 34, 67, 4, 9, 10, 7};
int limit = 12;
display(numbers);
displayReverse(numbers);
displaySum(numbers);
displayLessThan(numbers, limit);
displayHigherThanAverage(numbers);
}
public static void display(int[] numbers) {
// Write your code here
}
public static void displayReverse(int[] numbers) {
// Write your code here
}
public static void displaySum(int[] numbers) {
// Write your code here
}
public static void displayLessThan(int[] numbers, int limit) {
// Write your code here
}
public static void displayHigherThanAverage(int[] numbers) {
// Write your code here
}
}

Answers

Answer:

public class ArrayMethodDemo {

   public static void main (String args[]) {

       int[] numbers = {12, 15, 34, 67, 4, 9, 10, 7};

       int limit = 12;

       display(numbers);

       displayReverse(numbers);

       displaySum(numbers);

       displayLessThan(numbers, limit);

       displayHigherThanAverage(numbers);

   }

   

   public static void display(int[] numbers) {

       

       //Message to be displayed before printing out the numbers

      System.out.print("Numbers in the array: ");

       

       //loop through the numbers in the array and print each number

       for(int x: numbers){

           System.out.print(x + " ");

       }

       

       //print a new line

       System.out.println();

   }

   

   public static void displayReverse(int[] numbers) {

       

       //Message to be displayed before printing out the reverse of the array

       System.out.print("Reverse of the array numbers: ");

       

       

       //loop through the array starting from the last index

       for(int i = numbers.length - 1; i > 0; i--){

           System.out.print(numbers[i] + " ");

       }

       

       //print a new line

       System.out.println();

   }

   

   public static void displaySum(int[] numbers) {

       

       //initialize the sum variable

       int sum = 0;

       

       //loop through the array and add each element to sum

       for(int i = 0; i < numbers.length; i++){

           sum += numbers[i];

       }

       

       //print out the sum

      System.out.println("Sum: "  + sum);

       

   }

   

   public static void displayLessThan(int[] numbers, int limit) {

       

       //Text to be displayed before printing values less than the limit

       System.out.print("Values less than limit (" + limit + "): ");  

       //loop through the array and print numbers lower than the specified limit

       for(int i = 0; i < numbers.length; i++){

           if(numbers[i] < limit){

               System.out.print(numbers[i] + " ");

           }

       }

       

       //print a new line

       System.out.println();

   }

   

   public static void displayHigherThanAverage(int[] numbers) {

       //initialize the average variable

       double average = 0.0;

       

       //initialize the sum variable

       int sum = 0;

       

       

       //loop through the array and add each element to sum

      for(int i = 0; i < numbers.length; i++){

           sum += numbers[i];

       }

       

       //calculate the average

      average = sum / numbers.length;

       

       //Message to be displayed before printing the values higher than the average

       System.out.print("Values higher than average (" + average + "): ");

       

       

       //loop through the array and print numbers higher than the calculated average

      for(int i = 0; i < numbers.length; i++){

           if(numbers[i] > average){

               System.out.print(numbers[i] + " ");

           }

       }

       

       //print a new line

       System.out.println();

   }

   

}

Sample Output:

Numbers in the array: 12 15 34 67 4 9 10 7  

Reverse of the array numbers: 7 10 9 4 67 34 15  

Sum: 158

Values less than limit (12): 4 9 10 7  

Values higher than average(19.0):34 67

Explanation:

The code above contains comments explaining important parts of the code. Kindly go through the comments. A sample output, arising from running the application, has also been added to ace understandability.

What is the hamming distance between the following bits? Sent
bits: 101100111, Received bits: 100111001
Select one: 5. Or 3 or 6 or4​

Answers

I think

the hamming distance between the following bits its 5

what is the best plugin for subscription sites?

Answers

Answer:

Explanation:

MemberPress. MemberPress is a popular & well-supported membership plugin. ...

Restrict Content Pro. ...

Paid Memberships Pro. ...

Paid Member Subscriptions. ...

MemberMouse. ...

iThemes Exchange Membership Add-on. ...

Magic Members. ...

s2Member.

a) Why is eavesdropping done in a network?
b) Solve the following using checksum and check the data at the
receiver:
01001101
00101000​

Answers

Answer:

An eavesdropping attack is the theft of information from a smartphone or other device while the user is sending or receiving data over a network.

Missing: checksum ‎01001101 ‎00101000

Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box is found in the
File tab.
Home tab.
Design tab.
Slide Show tab.

Answers

Answer: Design tab

Explanation:

The page setup simply refers to the parameters which are defined by a particular user which is vital in knowing how a printed page will appear. It allows user to customize the page layout. The parameters include size, page orientation, quality of print,margin etc.

It should be noted that page setup options are vital for printing a PowerPoint presentation in a certain way and the button for the Page Setup dialog box can be found in the design tab.

Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after the shift operation. Does your system place 0s or 1s in the vacated bits?

Answers

Solution :

#include<[tex]$\text{stdio.h}$[/tex]>

#include<conio.h>

void dec_bin(int number) {

[tex]$\text{int x, y}$[/tex];

x = y = 0;

for(y = 15; y >= 0; y--) {

x = number / (1 << y);

number = number - x * (1 << y);

printf("%d", x);

}

printf("\n");

}

int main()

{

int k;

printf("Enter No u wanted to right shift by 4 : ");

scanf("%d",&k);

dec_bin(k);

k = k>>4; // right shift here.

dec_bin(k);

getch();

return 0;

}

is used for finding out about objects, properties and methods​

Answers

Answer:

science

Explanation:

Which of the following best explains how an analog audio signal is typically represented by a computer?
a. An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.
b. An analog audio signal is measured as a sequence of operations that describe how the sound can be reproduced. The operations are represented at the lowest level as programming instructions.
c. An analog audio signal is measured as input parameters to a program or procedure. The inputs are represented at the lowest level as a collection of variables.
d. An analog audio signal is measured as text that describes the attributes of the sound. The text is represented at the lowest level as a string.

Answers

Answer:

A. An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.

Explanation:

I took the test

Other Questions
(True or False?) The Soviet Union, prior to its collapse in 1991, successfully used the laissez-faireeconomic system to bring prosperity to the people of Russia and its satellite states. Directions: Select all the correct answers.Yvette needs 5/8 of a teaspoon of salt, 2/3 of a tablespoon of baking soda, and 3/4 of a cup of sugar to bake a cake.The order of the measurements from least to greatest are 5/8 < 3/4 < 2/3.The order of the measurements from least to greatest are 5/8 < 2/3 < 3/4.The numbers 5/8 and 3/4 are terminating decimals while 2/3 is a non-terminating decimal.The numbers 5/8 and 2/3 are terminating decimals.The number 5/8 is a terminating decimal while 3/4 and 2/3 are non-terminating decimals.The number expands to 0.75 while expands to 0.6.The number 5/8 expands to 0.625 while 3/4 expands to 0.75.The order of the measurements from least to greatest are 2/3 < 5/8 < 3/4 Which statement explains why carbon-14 dating cannot be used to date ancient rocks?O Carbon-14 decays at a varying rate.O Carbon-14 decays quickly leaving the amount too small to measure.O Carbon-14 can be used only to date the remains of organisms.O Carbon-14 has a half-life that is much longer than potassium. How can users open a shared worksheet if they do not have Excel installed on a computer? visit Microsofts website use Office365s home page open a PDF version for editing use Excel Online through the 365 portal Take care of your health . This is imperative sentence change in to passive If x) = 4x2 - 16 were shifted 5 units to the right and 2 down, what would thenew equation be?O A. h(x) = 4(x - 5)2 + 14B. h(x) = 4(x + 5)2 - 17C. h(x) = 4(x-18)2 - 5D. h(x) = 4(x - 5)2 - 18 help The questions are in the pic below ! why saving the amazon means saving more than just trees Explain how civil war in Syria may lead to an increase in nationalism in France. Bajo la accin del viento una puerta gira un ngulo de 90 en 5 s. Calcular su velocidad angular y la velocidad lineal de los puntos del bordesi el ancho de la puerta es de 50 cm. R. 0,314 rad/s, 0,157 m/s. The excess return is computed by ________ the average return for the investment. Group of answer choices subtracting the inflation rate from adding the inflation rate to subtracting the average return on the U.S. Treasury bill from adding the average return on the U.S. Treasury bill to subtracting the average return on long-term government bonds from Please me on this question! Jason just got tired for a new job and will make $80,000 in his first year. Jason wastold that he can expect to get raises of $5,000 every year going forward. How muchmoney in salary would Jason make in his 23rd year working at this job? Are female expatriates different?. Please help i cant tell if it line or area graph ! If im totally wrong help If the girl skater has a mass of 30 kg and moves backward at 5 m/s, what is the velocity or the boy skaterhis mass is 50 kg? which event from the story best represents the character-versus-nature conflict? What is the term for a structure that has no use in an organism?A.HomologuosB.IndexC.VestigialD.Sedimentary Solve for X.Then, Solve for Y. Best answers get Brainliest.