Question

In: Computer Science

*Create a python function that uses a while list to allow a user to enter values...

*Create a python function that uses a while list to allow a user to enter values for sales and to add each value into a list in order to track all values entered. Set the gathering of values to stop when the value of zero is entered. Then take the created list and calculate the values within the list to return the total for all the values. Next, take the previously created list and display all the values from smallest to largest and then from largest to smallest. Then create a function that will check to see if the value 100 is in the list. If it is in the list have the function return "Yes, 100 is in the list" if no have the function return, "No, 100 is not in the list".

*Next make another script and create a list that contains the values for each day of the week. For example; ‘Sunday’, ‘Monday’, ‘Tuesday’, etc….. Modify the script to have a for loop that prints out each day of the week contained within your list. Next, modify your script to ask for input from a user to Enter a number for the day of the week they would like to choose (1-7). Then print the output for the day of the week they have chosen from your list.

Solutions

Expert Solution

#Python code
def funccheck100(lst):
if 100 in lst:
return "Yes, 100 is in the list"
else:
return "No, 100 is not in the list"

def funcsales():
saleslist=[]
while True:
input1=int(input("Enter value to add to list: "))
saleslist.append(input1)
if 0 in saleslist:
break
  
sumtotal=0
for elem in saleslist:
sumtotal= sumtotal+ elem
  
print("Total sum of sales list is "+str(sumtotal))
saleslist.sort()
print("The sorted list from smallest to largest is: ")
print(saleslist)
print("The sorted list from largest to smallest is: ")
saleslist.sort(reverse=True)
print(saleslist)
  
print(funccheck100(saleslist))
  

funcsales()

def funcdays():
dayslist=['Sunday', 'Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday']
for day in dayslist:
print(day)
  
dayno= int(input("Enter day no: "))
print('Day is :')
print(dayslist[dayno-1])
  
funcdays()


Related Solutions

ARDUINO Create a function that will ask the user to enter the values for each of...
ARDUINO Create a function that will ask the user to enter the values for each of the three colors (red, green and blue) between 0 and 255. The function should check that the user does not enter a number bigger than 255 or smaller than 0. If this happens, the function should keep asking for a valid number.
create a program that will allow the user to enter a start value from 1 to...
create a program that will allow the user to enter a start value from 1 to 5, a stop value from 10 to 12 and a multiplier from 1 to 4. the program must display a multiplication table from the values entered. for example if the user enters: start 2, stop 10 and multiplier 3, the table should appear as follows: 3*2=6 3*3=9 3*4=12 . . . 3*10=30
Write a program in PYTHON, using a while loop, that asks the user to enter the...
Write a program in PYTHON, using a while loop, that asks the user to enter the amount that they have budgeted for the month. The program should then prompt the user to enter their expenses for the month. The program should keep a running total. Once the user has finished entering their expenses the program should then display if the user is over or under budget. The output should display the monthly budget, the total expenses and whether the user...
Write a while loop that will let the user enter a series of integer values and...
Write a while loop that will let the user enter a series of integer values and compute the total values and number of values entered. An odd number will stop the loop. Display the number of iterations and the total of the values after the loop terminates. for Loop Write a for loop to display all numbers from 13 - 93 inclusive, ending in 3. Write a for loop to display a string entered by the user backwards. do Loop...
Create a table in C of conversion from Celsius to Rankin. Allow the user to enter...
Create a table in C of conversion from Celsius to Rankin. Allow the user to enter the starting temperature and increment between lines. Print 25 lines in the table. Rankin = 9/5(Celsius + 273.15)
Create a Python program that: Allows the user to enter a phrase or sentence. The program...
Create a Python program that: Allows the user to enter a phrase or sentence. The program should then take the phrase or sentence entered Separate out the individual words entered Each individual word should then be added to a list After all of the words have been place in a list Sort the contents of the list Display the contents of the sorted list with each individual word displayed on a separate line Display a message to the user indicating...
. Create a Python function that asks the user for a number (integer). The function should...
. Create a Python function that asks the user for a number (integer). The function should then tell the user how many hundreds can go into the number, and how much is left over. Hint: the % operator calculates the remainder of a division. For example, 10 % 3 gives a result 1. Hint2: Deal with the positive and negative values in separate parts of an if-else structure. Get the calculation work for positive values first. For negative values, make...
Using python, allows a user to enter the values of two, 3x3 matrices and then select...
Using python, allows a user to enter the values of two, 3x3 matrices and then select from options including, addition, subtraction, matrix multiplication, and element by element multiplication. You should use numpy.matmul()for matrix multiplication(e.g. np.matmul(a, b)).The program should computer the appropriate results and return the results, the transpose of the results, the mean of the rows for the results, and the mean of the columns for the results.When entering data you should check that each value is numeric for the...
Write a Java program that prompts the user to enter a list of integer values and...
Write a Java program that prompts the user to enter a list of integer values and displays whether the list is sorted in increasing order or not. Here is a sample run. Note that the first number in the input indicates the number of the elements in the list. <Output> Enter list: 8 101516619111 The list is not sorted <End Output <Output> Enter list: 10 11344579 11 21 The list is already sorted <End Output Create a complete class for...
USE PYTHON. Create a program that will ask a user to enter whole positive numbers. The...
USE PYTHON. Create a program that will ask a user to enter whole positive numbers. The program will use a while loop to let the program keep running. The user will be allowed to use the program as long as the quitVariable is equal to 'y' or 'Y'. When the user decides to quit playing, say "Thanks for playing!". The program will use a for loop to test if the number are even or odd. If even print "number is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT