python
#Ignore line 2, it is just there to align with zybooks
requirements
print("5")
#Create a list with the following numbers and assign it to a
variable name: 1,2,3,4,5,6
#Convert the list to a tuple and assign it to a variable name
(dirrerent from the list's name)
#Try the following and press the run program button to which ones
work and which ones cause errors
#If a statement causes an error, use a # to comment it out
#Add the number 7 to the beggining of the list
#Add the number 7 to the beginning of the tuple
#Append the number 8 to the end of the list
#Append the number 8 to the end of the tuple
#Remove the second element from the list using the pop method
#Remove the second element from the tuple using the pop
method
#Get the sum and length of the list and compute the average of the
elements in the list
#Get the sum and length of the tuple and compute the average of the
elements in the tuple
#Create a tuple with the following numbers and assign it to a new
variable name: 2,4,6,8,9
#Convert the tuple to a list and assign it to a new variable
name
NOTE: For making it easy to undestand , i first uploaded the parts of the code and with outputs and then submitted the overall code at the end
"HERE IN THE GIVEN STATEMENTS"
"EXCEPT "APPENDING" AND "POPING" FOR TUPLE, ALL THE OTHER STATEMENTS GIVE OUTPUTS"
"appending and poping of tuple doesn't give outputs because "tuples" are immutable"
code for creating a list and converting it into a tuple,
adding 7 and appending 8 in a list and tuple
lis=[1,2,3,4,5,6]
tup=tuple(lis)
n=7
lis=[n]+lis
print(lis)
tup=(7,)+tup
print(tup)
lis.append(8)
print(lis)
#tup.append(8)
#we cant use append in a tuple because they are immutable
proof with output:

code for removing second element and finding sum , length , average of list and tuple
lis=[1,2,3,4,5,6]
tup=tuple(lis)
lis.pop(1)
print(lis)
#tup.pop(1)
#we cant use pop in tuples because they are immutable
length=len(lis)
s=0
for l in lis:
s=l+s
average = s / len(lis)
print(length,s,average)
length=len(tup)
s=0
for l in tup:
s=l+s
average = s / len(tup)
print(length,s,average)
proof with output:

code for creating a new tuple and converting it into a list and assigning new variables to it:
lis=[1,2,3,4,5,6]
tup=tuple(lis)
newtup=(2,4,6,8,9)
print(newtup)
print(type(newtup))
lis2=list(newtup)
print(lis2)
proof with output:

overall code for the given question:
lis=[1,2,3,4,5,6]
tup=tuple(lis)
n=7
lis=[n]+lis
print(lis)
tup=(7,)+tup
print(tup)
lis.append(8)
print(lis)
#tup.append(8)
#we cant use append in tuple
lis.pop(1)
print(lis)
#tup.pop(1)
#we cant use pop in tuple
length=len(lis)
s=0
for l in lis:
s=l+s
average = s / len(lis)
print(length,s,average)
length=len(tup)
s=0
for l in tup:
s=l+s
average = s / len(tup)
print(length,s,average)
newtup=(2,4,6,8,9)
print(newtup)
print(type(newtup))
lis2=list(newtup)
print(lis2)
proof with output:

python #Ignore line 2, it is just there to align with zybooks requirements print("5") #Create a...
please write these as you would into python. . i will give an thumbs ups 1. Evaluate the following expressions using Python 1. Product of first 10 even integers. 2. Midterm scores of 4 students are 89, 78, 90, 98. Find the average of these scores. 3. Evaluate 3 to the power 7 4. Find the number of foot in 345 inches. 5. find the remainder when 34567 divides by 17. 2. animals = ['cat', 'dog', 'lion', 'tiger', 'monkey', 'hyena']...
Questions 1. How to create a comment in python? 2. The way to obtain user input from command line 3. List standard mathematical operators in python and explain them 4. List comparison operators in python 5. Explain while loop. Give example 6. Explain for loop. Give example 7. How to create infinite loop? And how to stop it? 8. Explain a built-in function ‘range’ for ‘for’ loop 9. Explain break statement 10. Explain continue statement 11. Explain pass statement 12....
3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...
Using Swift playground and / or the command line for macOS (open Xcode, create a new Xcode project, macOS, command line tool), practice the following exercises: Exercise: Swift Variables Declare 2 variables/constants with some random values and any name of your choice Considering these 2 variables, one as a value of PI and other as a radius of circle, find the area of circle Print the area of circle Declare a string variable explicitly with value “Northeastern”. Declare a string...
PYTHON LANGUAGE Task 11 -Create a list with 5 items having 3 distinct data types -output the second element of the list -output the last element of the list using -negative index -positive index -len method Task 12 -Create a list with 3 items -add an item to the end of the list -remove the first item of the list -determine if an item exists in the list -if it does, display its index -if it does not, give user...
JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class. Print out the results after testing each of the methods in both of the classes and solving a simple problem with them. Task 1 – ArrayList Class Create an ArrayList class. This is a class that uses an internal array, but manipulates the array so that the array can be dynamically changed. This class should contain a default and overloaded constructor, where the default...
Python please help! Thanks you
Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use a sentinel, for example-1), and then calculate the GPA of all the grades and displays the GPA To do this you might need some help. Try to follow the following process (and check your progress by printing different values to make sure they are as they supposed to be): 1-...
PYTHON CODING HELP: BELOW ARE THE STEPS I NEED HELP WITH PLEASE. :) First create a text file named "items.txt" that has the following data in this order: Potatoes Tomatoes Carrots ... and have it be in the same directory as the Python program you are coding for this assignment. IMPORTANT: Your program should work with any size file. It should work with 100 items listed or with no items in the file! Write a Python program that ... 1....
C++ PRPGRAM- double-linked lists Create the .h and .cpp files for an Element class that contains the data and pointers for a double-link list for this application. Your linked list must consist of objects of this class. The class should contain at least the following elements (you may have more if you wish): The standard four constructors (default, parameterized, copy, move) The standard assignment operators (copy, move) A destructor Stream operators (<< and >>) The standard relational operators (<, <=,...
Create an application that provides a solution for problem 20.8 In addition to requirements specified in the description. The class must satisfy the following Default Constructor Two argument constructor for data used to initialize "first" and "second" "toString" method for displaying the "first" and "second" data elements Creates a "Comparator" object (to be used by the sort method; i.e. create an instance of a class that implements the interface [must override "compare" and "equals" methods]) The application must create an...