Modify the program you wrote for Chapter 6 Exercise 6 so it handles the following
exceptions:
• It should handle IOError exceptions that are raised when the file is opened
and data is read from it by printing "Trouble opening file. Try again." and
not executing any more of the code.
• It should handle any ValueError exceptions that are raised when the items
that are read from the file are converted to a number by printing "File must have
only numbers. Try again." and not executing any more of the code.
My code is as follows:
#try except
try:
#opening the file
read_file = open('numbers.txt', 'r')
#Store the numbers in the variable file_numbers.
file_numbers = read_file.read()
#close the file
read_file.close()
#Split the number of files in list_values.
list_values = file_numbers.split()
#how many numbers are there
list_length = len(list_values)
try:
#loop it up
for i in range(list_length):
list_values[i] = float(list_values[i])
#Add up all the numbers, put into list_sum
List_sum = sum(list_values)
#heres how we average it
Average_value = (List_sum)/list_length
#print
print(Average_value)
except ValueError:
print( "File must have only numbers. Try again." )
#handles IOError exceptions
except IOError:
#Display statement
print("Trouble opening file. Try again.")y:
#opening the file
read_file = open('numbers.txt', 'r')
#Store the numbers in the variable file_numbers.
file_numbers = read_file.read()
#close the file
read_file.close()
#Split the number of files in list_values.
list_values = file_numbers.split()
#how many numbers are there
list_length = len(list_values)
try:
#loop it up
for i in range(list_length):
list_values[i] = float(list_values[i])
#Add up all the numbers, put into list_sum
List_sum = sum(list_values)
#heres how we average it
Average_value = (List_sum)/list_length
#print
print(Average_value)
except ValueError:
print( "File must have only numbers. Try again." )
#handles IOError exceptions
except IOError:
#Display statement
print("Trouble opening file. Try again.")
This code will not print the average. Unsure why. The code functioned fine before the try,except lines were added in.

Answers

Answer 1

Answer:

#try except

try:

   #opening the file

   read_file = open('numbers.txt', 'r')

   #Store the numbers in the variable file_numbers.

   file_numbers = read_file.read()

   #close the file

   read_file.close()

   #Split the number of files in list_values.

   list_values = file_numbers.split()

   #how many numbers are there

   list_length = len(list_values)

   try:

       #loop it up

       for i in range(list_length):

           list_values[i] = float(list_values[i])

       #Add up all the numbers, put into list_sum

       List_sum = sum(list_values)

       #heres how we average it

       Average_value = (List_sum)/list_length

       #print

       print(Average_value)

   except ValueError:

       print( "File must have only numbers. Try again." )

   #handles IOError exceptions

except IOError:

   #Display statement

   print("Trouble opening file. Try again.")

Explanation:

The python program uses the try-except exception handling method to catch errors in the code. The IOError is used for catching input and output errors in the program like file handling while the ValueError keyword in the except statement is used to catch data type errors from a return statement, calculation or user input.


Related Questions

Consider the following method.


public int locate(String str, String oneLetter)

{
int j = 0;
while(j < str.length() && str.substring(j, j+1).compareTo*oneLetter < 0)
{
j++;
}
return j;
}

Which of the following must be true when the while loop terminates?

a. j == str.length()
b. str.substring(j, j+1) >= 0
c. j <= str.length() || str.substring(j, j+1).compareTo(oneLetter) > 0
d. j == str.length() || str.substring(j, j+1).compareTo(oneLetter) >= 0
e. j == str.length() && str.substring(j, j+1).compareTo(oneLetter) >= 0

Answers

Answer:

All

Explanation:

From the available options given in the question, once the while loop terminates any of the provided answers could be correct. This is because the arguments passed to the while loop indicate two different argument which both have to be true in order for the loop to continue. All of the provided options have either one or both of the arguments as false which would break the while loop. Even options a. and b. are included because both would indicate a false statement.

Write a method named removeRange that accepts an ArrayList of integers and two integer values min and max as parameters and removes all elements values in the range min through max (inclusive). For example, if an ArrayList named list stores [7, 9, 4, 2, 7, 7, 5, 3, 5, 1, 7, 8, 6, 7], the call of removeRange(list, 5, 7); should change the list to store [9, 4, 2, 3, 1, 8

Answers

Answer:

Answered below

Explanation:

public ArrayList<Integer> removeRange(ArrayList<Integer> X, int min, int max){

int i; int j;

//Variable to hold new list without elements in //given range.

ArrayList<Integer> newList = new ArrayList<Integer>();

//Nested loops to compare list elements to //range elements.

if(max >= min){

for( i = 0; i < x.length; I++){

for(j = min; j <= max; j++){

if( x [i] != j){

newList.add( x[i] );

}

}

}

return newList;

}

}

Create the logic for a program that prompts a user for 12 numbers and stores them in an array. Pass the array to a method that reverses the order of the numbers. Display the reversed numbers in the main program.

Answers

Answer:

Explanation:

The following program is written in Python. It first creates a method that reverses the array using the built in reverse function. Then it creates the array, creates a loop to ask the user to enter 12 numbers while passing each input into the array. Finally, it passes that array into the previously created reverse method and prints out the new array.

def reverse(num_arr):

   num_arr.reverse()

   return num_arr

num_arr = []

for x in range(12):

   num = input("Enter a number")

   num_arr.append(num)

print(reverse(num_arr))

Write a function that receives three StaticArrays where the elements are already i n sorted order and returns a new Static Array only with those elements that appear i n all three i nput arrays. Original arrays should not be modified. If there are no elements that appear i n all three i nput arrays, return a Static Array with a single None element i n i t.

Answers

Answer:

Explanation:

The following code is written in Python. It is a function that takes the three arrays as parameters. It loops over the first array comparing to see if a number exists in the other arrays. If it finds a number in all three arrays it adds it to an array called same_elements. Finally, it prints the array.

def has_same_elements(arr1, arr2, arr3):

   same_elements = []

   

   for num1 in arr1:

       if (num1 in arr2) and (num1 in arr3):

           same_elements.append(num1)

       else:

           continue

   

   print(same_elements)

instructions and programs data are stored in the same memory in which concept

Answers

Answer:

The term Stored Program Control Concept refers to the storage of instructions in computer memory to enable it to perform a variety of tasks in sequence or intermittently.

Last one, this is fashion marketing and I need to know the answer to get the 80%

Answers

Answer:

D. It requires that each item of stock is counted and recorded to determine stock levels

Explanation:

A perpetual system of inventory can be defined as a method of financial accounting, which involves the updating informations about an inventory on a continuous basis (in real-time) as the sales or purchases are being made by the customers, through the use of enterprise management software applications and a digitized point-of-sale (POS) equipment.

Under a perpetual system of inventory, updates of the journal entry for cost of goods sold or received would include debiting accounts receivable and crediting sales immediately as it is being made or happening.

Hence, an advantage of the perpetual system of inventory over the periodic system of inventory is that, it ensures the inventory account balance is always accurate provided there are no spoilage, theft etc.

The following are the characteristic of a perpetual inventory system;

I. It is the most popular choice for modern business.

II. Inventory is updated in near real-time.

III. It provides up-to-date balance information and requires fewer physical counts.

Instructions
An object's momentum is its mass multiplied by its velocity. Write a program that accepts an object's mass (in kilograms) and velocity (in meters per second) as inputs, and then outputs its momentum. Below is an example of the progam input and output:
Mass: 5
Velocity: 2.5
The object's momentum is 12.5

Answers

Answer:

mass = float(input("Mass: "))

velocity = float(input("Velocity: "))

momentum = mass * velocity

print("The object's momentum is ", momentum)

Explanation:

*The code is in Python.

Ask the user to enter the mass and velocity. Since both of the values could be decimal numbers, cast them as float

Calculate the momentum using given information, multiply mass by velocity

Print the momentum as example output

Create a file named homework_instructions.txt using VI editor and type in it all the submission instructions from page1 of this document. Save the file in a directory named homeworks that you would have created. Set the permissions for this file such that only you can edit the file while anybody can only read. Find and list (on the command prompt) all the statements that contain the word POINTS. Submit your answer as a description of what you did in a sequential manner

Answers

Answer:

mkdir homeworks    // make a new directory called homeworks.

touch homework_instructions.txt //create a file called homework_instruction

sudo -i    // login as root user with password.

chmod u+rwx homework_instructions.txt  // allow user access all permissions

chmod go-wx homework_instructions.txt // remove write and execute permissions for group and others if present

chmod go+r homework_instructions.txt  // adds read permission to group and others if absent.

grep POINTS homework_instructions.txt | ls -n

Explanation:

The Linux commands above first create a directory and create and save the homework_instructions.txt file in it. The sudo or su command is used to login as a root user to the system to access administrative privileges.

The user permission is configured to read, write and execute the text file while the group and others are only configured to read the file.

Read Chapter 2 in your text before attempting this project. An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker's gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker's gross pay, each withholding amount, and the net take-home pay for the week.

Answers

Answer:

Answered below

Explanation:

#Answer is written in Python programming language

hrs = int(input("Enter hours worked for the week: "))

dep = int(input ("Enter number of dependants: "))

pay = 16.78

ovpay = pay * 1.5

if hrs <= 40:

wage = hrs * pay

else:

wage = hrs * ovpay

ss = wage * 0.06

fedtax = wage * 0.14

statetax = wage * 0.05

dues = 10

if dep >= 3:

ins = 35

net_pay = wage - ss - fedtax - statetax - dues - ins

print(wage)

print ( ss, fedtax, statetax, dues, ins)

print (net_pay)

Do you think it is acceptable to copy and paste material from a web page into a term paper?​

Answers

Answer:

Possibly, if it is a small quote from a factual and reliable site which properly cited, allowed, and being used to prove an idea or as support for a claim. You can also paraphase. However, if it is a large piece of material in which no effort is needed for the person submitting the paper, then no. Copy and paste is generally only saved for quoting something direct, such as results from scientific reasearch. You really need to be careful not to plagarise; so, for a term paper, it may be a better idea to stay clear of copy and paste if you are unsure.

Answer:

C. No, because you should not pass other people’s work off as your own.

Explanation:

Hardware Name:
Description:
Picture:
1. Motherboard





2. Power Supply



3. CPU (Central Processing Unit)



4. Random Access Memory (RAM)



5. Hard Disk Drive/Solid State Drive



6. Video Card



7. Optical Drives



8. Input and Output Devices

Answers

Answer:

I think 2.power supply yaar

Help need right now pls
Read the following Python code:
yards - 26
hexadecimalYards = hex (yards)
print (hexadecimalYards)
Which of the following is the correct output? (5 points)
A. 0b1a

B. 0d1a

C. 0h1a

D. 0x1a

Answers

Answer:

d. 0x1a

Explanation:

Online privacy and data security are a growing concern. Cybercrime is rampant despite the various security measures taken.

-Mention five tools to safeguard users against cybercrime. How do these tools help decrease crime?
-Provide the details of how each of these tools work.
-Describe how these tools are helping to restrict cybercrime.

Answers

Answer:

The SANS Top 20 Critical Security Controls For Effective Cyber Defense

Explanation:

Password/PIN Policy

Developing a password and personal identification number policy helps ensure employees are creating their login or access credentials in a secure manner. Common guidance is to not use birthdays, names, or other information that is easily attainable.

Device Controls

Proper methods of access to computers, tablets, and smartphones should be established to control access to information. Methods can include access card readers, passwords, and PINs.

Devices should be locked when the user steps away. Access cards should be removed, and passwords and PINs should not be written down or stored where they might be accessed.

Assess whether employees should be allowed to bring and access their own devices in the workplace or during business hours. Personal devices have the potential to distract employees from their duties, as well as create accidental breaches of information security.

As you design policies for personal device use, take employee welfare into consideration. Families and loved ones need contact with employees if there is a situation at home that requires their attention. This may mean providing a way for families to get messages to their loved ones.

Procedures for reporting loss and damage of business-related devices should be developed. You may want to include investigation methods to determine fault and the extent of information loss.

Internet/Web Usage

Internet access in the workplace should be restricted to business needs only. Not only does personal web use tie up resources, but it also introduces the risks of viruses and can give hackers access to information.

Email should be conducted through business email servers and clients only unless your business is built around a model that doesn't allow for it.

Many scams and attempts to infiltrate businesses are initiated through email. Guidance for dealing with links, apparent phishing attempts, or emails from unknown sources is recommended.

Develop agreements with employees that will minimize the risk of workplace information exposure through social media or other personal networking sites, unless it is business-related.

Encryption and Physical Security

You may want to develop encryption procedures for your information. If your business has information such as client credit card numbers stored in a database, encrypting the files adds an extra measure of protection.

Key and key card control procedures such as key issue logs or separate keys for different areas can help control access to information storage areas.

If identification is needed, develop a method of issuing, logging, displaying, and periodically inspecting identification.

Establish a visitor procedure. Visitor check-in, access badges, and logs will keep unnecessary visitations in check.

Security Policy Reporting Requirements

Employees need to understand what they need to report, how they need to report it, and who to report it to. Clear instructions should be published. Training should be implemented into the policy and be conducted to ensure all employees understand reporting procedures.

Empower Your Team

One key to creating effective policies is to make sure that the policies are clear, easy to comply with, and realistic. Policies that are overly complicated or controlling will encourage people to bypass the system. If you communicate the need for information security and empower your employees to act if they discover a security issue, you will develop a secure environment where information is safe.

Answer:

anyone know if the other answer in right?

Explanation:

PLEASE HELP
Which of the following best describes the existence of undecidable problems?

Answers

Answer:

D.

Explanation:

Its the exact definition of an undecidable problem. Plus I have my notebook open next to me and that's what it says, trust bro.

An undecidable problem is a problem for which no algorithm can be constructed that always produces a correct output. The correct option is D.

What is undecidable problem?

Problems that cannot be solved by an algorithm are known as undecidable problems since no computer program can come up with a solution that works for every scenario.

This is a key drawback of computing systems, and it has been analytically shown that some issues are intractable from the start.

Decision issues that lack an algorithmic solution are referred to as undecidable.

A issue that cannot be solved by a computer or computer software of any type has never been solved by a computer. There is no such thing as a Turing machine that can solve an insoluble problem.

Thus, the correct option is D.

For more details regarding undecidable problems, visit:

https://brainly.com/question/30187947

#SPJ6

list 5 differences between monitors and printers​

Answers

monitor is a display for a computer system.
monitor is the primary memorable device.
a printer is a device that builds one static image and captures it permanently on a suitable medium.
a printer cannot project information unlike a monitor.
a monitor is mainly used for commands.

Consider the definition of the Person class below. The class uses the instance variable adult to indicate whether a person is an adult or not.

public class Person
{
private String name;
private int age;
private boolean adult;
public Person (String n, int a)
{

name = n;
age = a;
if (age >= 18)
{
adult = true;
}
else
{
adult = false;
}
}
}

Which of the following statements will create a Person object that represents an adult person?

a. Person p = new Person ("Homer", "adult");
b. Person p = new Person ("Homer", 23);
c. Person p = new Person ("Homer", "23");
d. Person p = new Person ("Homer", true);
e. Person p = new Person ("Homer", 17);

Answers

Answer:

b. Person p = new Person ("Homer", 23);

Explanation:

The statement that will create an object that represents an adult person would be the following

Person p = new Person ("Homer", 23);

This statement creates a Person object by called the Person class and saving it into a variable called p. The Person method is called in this object and passed a string that represents the adult's name and the age of the adult. Since the age is greater than 18, the method will return that adult = true.

The other options are either not passing the correct second argument (needs to be an int) or is passing an int that is lower than 18 meaning that the method will state that the individual is not an adult.

What is media framing?

Answers

Answer:

media frame all news items by specific values, facts, and other considerations, and endowing them with greater apparent for making related judgments

Explanation:

Read three integers from user input without a prompt. Then, print the product of those integers. Ex: If input is 2 3 5, output is 30. Note: Our system will run your program several times, automatically providing different input values each time, to ensure your program works for any input values. See How to Use zyBooks for info on how our automated program grader works.

Answers

Answer:

Explanation:

The following code is written in Java and simply grabs the three inputs and saves them into three separate variables. Then it multiplies those variables together and saves the product in a variable called product. Finally, printing out the value of product to the screen.

import java.util.Scanner;

public class Main{

   public static void main(String[] args){

       Scanner in = new Scanner(System.in);

       int num1 = in.nextInt();

       int num2 = in.nextInt();

       int num3 = in.nextInt();

       int product = num1 * num2 * num3;

       System.out.println(product);

   }

}

Answer: Python

Explanation:

num1 = int(input())

num2 = int(input())

num3 = int(input())

product = num1 * num2 * num3

print(product)

importance of spread sheets​

Answers

Answer:

Spreadsheets are an essential business and accounting tool. They can vary in complexity and can be used for various reasons, but their primary purpose is to organize and categorize data into a logical format. Once this data is entered into the spreadsheet, you can use it to help organize and grow your business.

Explanation:

Spreadsheets are an essential business and accounting tool. They can vary in complexity and can be used for various reasons, but their primary purpose is to organize and categorize data into a logical format. Once this data is entered into the spreadsheet, you can use it to help organize and grow your business.


What are the two basic functions (methods) used in classical encryption algorithms?

Answers

Substitution and transposition

substitution and transport

Where does the revolver get the IP address of a site not visited before?


the file server


the print spooler


the IP provider


the name server

Answers

Answer:

The name server

Explanation:

The correct answer is name servers because on the internet, they usually help web browsers and other services to access the records of the domain name system(DNS) by direction of traffic through connection of the domain name with the IP address of the web server.

most of the answers for this test is wrong.

Answers

Answer: C, Showing professional behavior.

Explanation:

Your class is in groups, working on a sets worksheet. Your classmate suggests that if the union of two non-empty sets is the empty set, then the sets must be disjoint. What would you say to explain how this statement is false, and how would you help correct them

Answers

Answer:

The answer is "[tex]\bold{A \cap\ B=\phi}[/tex]"

Explanation:

let

[tex]A=\{1,2,3\}\\\\B=\{4,5,6\}[/tex]

A and B are disjoint sets and they are not an empty set  then:

[tex]A\cup\ B=\{1,2,3,4,5,6\} \\\\A\cup\ B\neq 0[/tex]

therefore if the intersection of the two non-empty sets is the empty set then its disjoint set, which is equal to [tex]\bold{A \cap\ B=\phi}[/tex].

Write a program that plays the popular scissor-rockpaper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Here are sample runs:

scissor (0), rock (1), paper (2): 1
The computer is scissor. You are rock. You won
scissor (0), rock (1), paper (2): 2
The computer is paper. You are paper too. It is a draw

Answers

Answer:

import random

computer = random.randint(0, 2)

user = int(input("scissor (0), rock (1), paper (2): "))

if computer == 0:

   if user == 0:

       print("The computer is scissor. You are scissor too. It is a draw")

   elif user == 1:

       print("The computer is scissor. You are rock. You won")

   elif user == 2:

       print("The computer is scissor. You are paper. Computer won")

elif computer == 1:

   if user == 0:

       print("The computer is rock. You are scissor. Computer won")

   elif user == 1:

       print("The computer is rock. You are rock too. It is a draw")

   elif user == 2:

       print("The computer is rock. You are paper. You won")

elif computer == 2:

   if user == 0:

       print("The computer is paper. You are scissor. You won")

   elif user == 1:

       print("The computer is paper. You are rock. Computer won")

   elif user == 2:

       print("The computer is paper. You are paper too. It is a draw")

Explanation:

*The code is in Python.

Import the random to be able to generate number number

Generate a random number between 0 and 2 (inclusive) using randint() method and set it to the computer variable

Ask the user to enter a number and set it to the user variable

Check the value of computer the computer variable:

If it is 0, check the value of user variable. If user is 0, it is a draw. If user is 1, user wins. If user is 2, computer wins

If it is 1, check the value of user variable. If user is 0, computer wins. If user is 1, it is a draw. If user is 2, user wins

If it is 2, check the value of user variable. If user is 0, user wins. If user is 1, computer wins. If user is 2, it is a draw

udsvb kbfnsdkmlfkmbn mk,dsldkfjvcxkm ,./ss.dskmcb nmld;s,fknvjf

Answers

Answer:

not sure what language it is

Explanation:

In CengageNOWv2, you may move, re-size, and rearrange panels in those assignments that use multiple panels.

Answers

Answer:

true

Explanation:

trust me lol, I promise it's correct.

The Clean Air Act Amendments of 1990 prohibit service-related releases of all ____________. A) GasB) OzoneC) MercuryD) Refrigerants

Answers

Answer:

D. Refrigerants

Explanation:

In the United States of America, the agency which was established by US Congress and saddled with the responsibility of overseeing all aspects of pollution, environmental clean up, pesticide use, contamination, and hazardous waste spills is the Environmental Protection Agency (EPA). Also, EPA research solutions, policy development, and enforcement of regulations through the resource Conservation and Recovery Act .

The Clean Air Act Amendments of 1990 prohibit service-related releases of all refrigerants such as R-12 and R-134a. This ban became effective on the 1st of January, 1993.

Refrigerants refers to any chemical substance that undergoes a phase change (liquid and gas) so as to enable the cooling and freezing of materials. They are typically used in air conditioners, refrigerators, water dispensers, etc.

Answer:

D

Explanation:

let m be a positive integer with n bit binary representation an-1 an-2 ... a1a0 with an-1=1 what are the smallest and largest values that m could have

Answers

Answer:

Explanation:

From the given information:

[tex]a_{n-1} , a_{n-2}...a_o[/tex] in binary is:

[tex]a_{n-1}\times 2^{n-1} + a_{n-2}}\times 2^{n-2}+ ...+a_o[/tex]

So, the largest number posses all [tex]a_{n-1} , a_{n-2}...a_o[/tex]  nonzero, however, the smallest number has [tex]a_{n-2} , a_{n-3}...a_o[/tex] all zero.

The largest = 11111. . .1 in n times and the smallest = 1000. . .0 in n -1 times

i.e.

[tex](11111111...1)_2 = ( 1 \times 2^{n-1} + 1\times 2^{n-2} + ... + 1 )_{10}[/tex]

[tex]= \dfrac{1(2^n-1)}{2-1}[/tex]

[tex]\mathbf{=2^n -1}[/tex]

[tex](1000...0)_2 = (1 \times 2^{n-1} + 0 \times 2^{n-2} + 0 \times 2^{n-3} + ... + 0)_{10}[/tex]

[tex]\mathbf {= 2 ^{n-1}}[/tex]

Hence, the smallest value is [tex]\mathbf{2^{n-1}}[/tex] and the largest value is [tex]\mathbf{2^{n}-1}[/tex]

During TCP/IP communications between two network hosts, information is encapsulated on the sending host and decapsulated on the receiving host using the OSI model. Match the information format with the appropriate layer of the OSI model.

a. Packets
b. Segments
c. Bits
d. Frames

1. Session Layer
2. Transport Layer
3. Network Layer
4. Data Link Layer
5. Physical Layer

Answers

Answer:

a. Packets - Network layer

b. Segments - Transport layer

c. Bits - Physical layer

d. Frames - Data link layer

Explanation:

When TCP/IP protocols are used for communication between two network hosts, there is a process of coding and decoding also called encapsulation and decapsulation.

This ensures the information is not accessible by other parties except the two hosts involved.

Operating Systems Interconnected model (OSI) is used to standardise communication in a computing system.

There are 7 layers used in the OSI model:

1. Session Layer

2. Transport Layer

3. Network Layer

4. Data Link Layer

5. Physical Layer

6. Presentation layer

7. Application layer

The information formats given are matched as

a. Packets - Network layer

b. Segments - Transport layer

c. Bits - Physical layer

d. Frames - Data link layer

A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AND the price of each item, and then simply displays whatever the user typed in on the screen nicely formatted. Some example input might be: Apples 2.10 Hamburger 3.25 Milk 3.49 Sugar 1.99 Bread 1.76 Deli Turkey 7.99 Pickles 3.42 Butter 2.79 Remember - you will be outputting to the screen - so do a screen capture to turn in your output. Also turn in your PYTHON program code.

Answers

Answer:

name = []

price = []

for i in range(0,8):

item_name = input('name of item')

item_price = input('price of item')

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

Explanation:

Python code

Using the snippet Given :

Apples 2.10

Hamburger 3.25

Milk 3.49

Sugar 1.99

Bread 1.76

Deli Turkey 7.99

Pickles 3.42

Butter 2.79

name = []

price = []

#name and price are two empty lists

for i in range(0,8):

#Allows users to enter 8 different item and price choices

item_name = input('name of item')

item_price = input('price of item')

#user inputs the various item names and prices

#appends each input to the empty list

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

# this prints the name and prices of each item from the list.

Other Questions
Q3. Which of the following is NOT a synonym for"Cold":A- PleasantB- Sinus InfectionC- ChillyD- Distant Which graph represents the function f(x)=-|x|-2? guys I'm stuck plz help!!!! Solve and check please help ty Need help again ASAP Use the distributive property to simplify the expression and then evaluate. Let x= 4 and y= -2-6(-2x + 3y + 8) A 1.018 g sample pure platinum metal was reacted with HCl to form 1.778 g of a compound containing only platinum and chlorine. Determine the empirical formula of this "Pt-Cl" Compound. Why does Sodium bond with Chlorine??? Flesch Corporation produces and sells two products. In the most recent month, Product C90B had sales of $35,640 and variable expenses of $8,910. Product Y45E had sales of $31,680 and variable expenses of $12,672. The fixed expenses of the entire company were $20,000. If the sales mix were to shift toward Product C90B with total dollar sales remaining constant, the overall break-even point for the entire company: 10. How much interest will be earned in 4 yearsfrom $2,450 placed in a savings account at 62 %simple interest? Write a short note on Great Wall of China. A 56-kg skater initially at rest throws a 5.0-kg medicine ball horizontally to the left. Suppose the ball is accelerated through a distance of 1.0 m before leaving the skater's hand at a speed of 7.0 m/s. Assume the skater and the ball to be point-like and the surface to be frictionless and ignore air resistance. Use a vertical y-axis with the positive direction pointing up and a horizontal x-axis with the positive direction pointing to the right. What will happen to the skater and the ball after the ball is thrown A line has a slope of 1/9 and passes through the point (6, 6). What is its equation in point- slope form? Inspirational Poems... Writing Can someone help with these Cellular respiration takes place in the______. Another one bites the dust 68.8 rounded to one decimal place is ? 1. Record your prediction (hypothesis) as an if then statement. (For example: If you select the GO button, then the train will move) If the sound source is moving then the pitch of the sound will ___________________ to the observer. What was the main idea of Patrick Henry's speech to the house of burgesses?