Question

1-Create a week_tuple and assign the days of the week as strings to the week_tuple. b....

1-Create a week_tuple and assign the days of the week as strings to the week_tuple. b. Print out the elements in the week_tuple.

2-a. The following list has been declared as follows: credit_list = [24,3,15] b. Convert the credit_list to a tuple named credit_tuple. c. Print out the elements in the credit_tuple.

3-a. Write an initialize_list_values function that takes in a number for the number of elements in a list and an initial value for each element. The function creates a new list and appends the elements with the initial value to the new list. b. Pass in 5 and 3.4 as arguments to the intital_list_values and store the returned list in data_list. c. Use a loop to print the elements of the data_list. ---

4- Create a tuple named inventory_items_tuple which has Raspberry Pi 3, Raspberry Pi 2, and Raspberry Pi Camera Module. b. Create a tuple named out_of_stock_items_tuple which has Raspberry Pi Zero. (Hint: add a , after “Raspberry Pi Zero”.) c. Append these two tuples together into the all_items_tuple. Print out each element in the tuple using a for loop and use the len function to determine the number of elements in the tuple. --

5- Create a list of lists consisting of three rows and four columns, which were initially set to 0. b. Prompt the user to initialize each element in the list of lists. c. Compute the sum of all of the elements in the list. You may use the sum function. d. Prompt the user to enter a row number and use a loop to calculate the sum of the elements in the row and print out the sum.

Homework Answers

Answer #1
#1
week_tuple=('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
print(week_tuple)

#2
credit_list = [24,3,15]
credit_tuple=tuple(credit_list)
print(credit_tuple)

#3
def initialize_list_values(n,v):
    data_list=[]
    for i in range(n):
        data_list.append(v);
    for i in data_list:
        print(i)

initialize_list_values(5,3.4)

#4
inventory_items_tuple=('Raspberry Pi 3','Raspberry Pi 2','Raspberry Pi Camera')
out_of_stock_items_tuple=('Raspberry Pi Zero','a')
all_items=()
all_items=list(inventory_items_tuple)
all_items.append(out_of_stock_items_tuple[0])
all_items_tuple=tuple(all_items)
for i in all_items_tuple:
    print(i)
print(len(all_items_tuple))

Here is the desired code. We are only allowed to complete 4 parts at a time.
Thank you

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create a new file named quiz_loops.py. b. Write your name and date in a comment. c....
Create a new file named quiz_loops.py. b. Write your name and date in a comment. c. Write a for loop which will display this set of values 2,4,6,8,10,12,14,16. d. Write a while which will display this set of values 16,13,10,7,4,1,-2. e. Write a for loop which will print ‘Loops are fun’ three times. f. Write a while loop that will prompt you for four numbers. Convert the number to an integer. Compute the power as power = power ** number....
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
In this programming exercise you will create an algorithm for solving the following version of the...
In this programming exercise you will create an algorithm for solving the following version of the m Smallest Numbers problem.   Instead of just returning the m smallest values as in homework 1, you want to return a list of the positions where the m smallest values are located without changing the original array. Your algorithm should meet the following specifications: mSmallest( L[1..n], m ) Pre: L is a list of distinct integer values. n is the number of elements in...
c) A function named tallied_data() that takes in a nested list (Use this on the data...
c) A function named tallied_data() that takes in a nested list (Use this on the data from part 1, but it should be able to be used to solve similar problems), indices for two columns and returns a tallied list. The inputs are: i) a nested list, ii) an index for the ‘reference column’/ ‘category’ (col_ref) iii) another index for the column to be tallied (col_tally) iv) this function returns a list of tuples where each element is a tuple...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns the index of the first occurance of the smallest value in the array. Your function must be able to process all the elements in the array. Create a function prototype and function definition (after the main function). Your main function should declare a 100 element integer array. Prompt the user for the number of integers to enter and then prompt the user for each...
1. Write a function called compute_discount which takes a float as the cost and a Boolean...
1. Write a function called compute_discount which takes a float as the cost and a Boolean value to indicate membership. If the customer is a member, give him/her a 10% discount. If the customer is not a member, she/he will not receive a discount. Give all customers a 5% discount, since it is Cyber Tuesday. Return the discounted cost. Do not prompt the user for input or print within the compute_discount function. Call the function from within main() and pass...
Questions: 1. (5 marks) Create a VB.NET Console Application that defines a function Smallest and calls...
Questions: 1. Create a VB.NET Console Application that defines a function Smallest and calls this function from the main program. The function Smallest takes three parameters, all of the Integer data type, and returns the value of the smallest among the three parameters. The main program should (1) Prompt a message (using Console.WriteLine) to ask the user to input three integers. (2) Call the built-in function Console.ReadLine() three times to get the user’s input. (3) Convert the user’s input from...
3. Create vector V of integers randomly distributed on [-10 20] .display the vector. a) Use...
3. Create vector V of integers randomly distributed on [-10 20] .display the vector. a) Use for-end loop to examine each element of the vector. If element is positive double its value ; if element is negative triple its value. Display the result. b) without using for loop find number of elements in V that are greater than 1 c) without using for loop find all of elements in V that are greater or equal to -7 and are less...
I have trouble in my code with - Create and append the fancySheet link element to...
I have trouble in my code with - Create and append the fancySheet link element to the document head - Create and append figBox element to element with id box - Populate the figure box with preview images of the five fancy style sheets I don't understand what went wrong. New Perspectives HMTL5, CSS3, and JavaScript T12 Case Problem 1: New Accents Photography JavaScript File Event Listener Go to the na_styler.js file in your editor. Add an event listener that...
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT