Screenshot:
![main.py 1- def main(): Number=int(input(How many numbers do you want to add?: )) Mynum=[] count=0 Total=0 while count Numbe](http://img.homeworklib.com/questions/30e321e0-f6f0-11eb-b2cd-f1be50e13852.png?x-oss-process=image/resize,w_560)
Code:
def main():
Number=int(input("How many numbers do you want
to add?: "))
Mynum=[]
count=0
Total=0
while count<Number:
values=int(input('input
the number one at a time: '))
Total=Total+values
Mynum.append(values)
count=count+1
print("Here is the list: ",Mynum)
print("Sum of the list items is: ",Total)
Average=Total/Number
print("Average of the list items is:
",Average)
main()
Processing Items in a list • Classwork1 • Create your own list to get the average...
Python: Create a function count_target_in_list that takes a list of integers and the target value then counts and returns the number of times the target value appears in the list. Write program in that uses get_int_list_from_user method to get a list of 10 numbers, then calls the count_target_list method to get the count then prints the number of times the target was found in the list. def get_int_list_from_user(): lst=[] y = int(input("Enter number of numbers")) for x in range(y): lst.append(int(input("Enter...
I really need help making a linked list program in C++, the program in total should have 3 source files: IntList.h IntList.cpp IntListTest.cpp The class should contain the following functions: Constructor Destructor (should use removeAll() function) insert(int) - inserts the given int into the list (in order, duplicates are allowed) remove(int) - removes the given int from the list. Returns true if successful, false otherwise. print() - prints the list in-order (all on one line, comma delimited; no comma at...
Instructions We're going to create a program which will allow the user to add values to a list, print the values, and print the sum of all the values. Part of this program will be a simple user interface. 1. In the Program class, add a static list of doubles: private statie List<double> _values new List<double>) this is the list of doubles well be working with in the program. 2. Add ReadInteger (string prompt) , and ReadDouble(string prompt) to the...
Q1 (2 pts) Shopping list
Write a program that prompts a user for items on their shopping
list and keeps prompting the user until they enter "Done" (make
sure your program can stop even if the user enters "Done" with
different cases, like "done"), then prints out the items in the
list, line by line, and prints the total number of items on the
shopping list.
Output (after collecting items in the while loop) should look
something like this:
Apple...
Using a sort method and my previous code (put inside of addHours method if possible), how would I get the list of each employee's total hours to display in order of least amount of hours to greatest. An explanation for each step would also be great. import random #Create function addHours def addHours(lst): #Display added hours of employees print("\nEmployee# Weekly Hours") print("----------------------------") print(" 1 ",sum(lst[0])) print(" 2 ",sum(lst[1])) print(" 3 ",sum(lst[2])) #Create main function def main(): #Create first empty list...
C++ Modify this program (or create your own) so that it performs the following tasks: 1. Insert the numbers into the list in sorted order (ascending). This will require you to keep the list sorted as you continue to insert new numbers. 2. When adding a new number, first check to see whether it is larger than the last number currently in the list. If it is, add it directly to the end of the list, i.e., do not traverse...
Please help me finish my code. Before the final pause in the main function, create an ArrayList of another type such as double, char, short, bool, float, etc. Your choice. Add five data items to your array as we did for the int and string array lists. Print them out with a for loop as we did before. Print out the count and capacity of your new array list. Source.cpp #include #include #include #include "ArrayList.h" using namespace std; /// Entry...
Change your C++ average temperatures program to: In a non range-based loop Prompt the user for 5 temperatures. Store them in an array called temperatures. Use a Range-Based loop to find the average. Print the average to the console using two decimals of precision. Do not use any magic numbers. #include<iostream> using namespace std; void averageTemperature() // function definition starts here { float avg; // variable declaration int num,sum=0,count=0; /* 'count' is the int accumulator for number of...
How can I modify my program to accept a list of integers (up to 20 entries) from the user into a list and prints the numbers entered by the user in ascending order, their sum and their average. The program then stops when the user inputs -100 as a number to search. #function that returns largest number def max(numOne,numTwo,numThree): if(numOne > numTwo and numOne > numThree): return numOne elif(numTwo > numOne and numTwo > numThree): return numTwo elif(numThree > numOne...
python programming: Can you please add comments to describe in detail what the following code does: import os,sys,time sl = [] try: f = open("shopping2.txt","r") for line in f: sl.append(line.strip()) f.close() except: pass def mainScreen(): os.system('cls') # for linux 'clear' print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print(" SHOPPING LIST ") print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print("\n\nYour list contains",len(sl),"items.\n") print("Please choose from the following options:\n") print("(a)dd to the list") print("(d)elete from the list") print("(v)iew the...