Question

In: Computer Science

Python Programming- 9.11 S80 MT Practice1 #This is a template for practicing mutability and conversion #Create...

Python Programming- 9.11 S80 MT Practice1

#This is a template for practicing mutability and conversion
#Create and assign the following list of numbers to a list data type and variable name: 88.5, 90, 75, 70, 85.6
#convert the list to a tuple and assign the tuple a different variable name
#Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name
#append the user entered grade to the list
#update the tuple to reflect the user entered grade (Tip, replace the entire tuple with the list converted to a tuple)
#compute the current average grade using the tuple
#Display the average that you calculated in the previous line using the following format:
#Your average score is [calculated average]. (Tip: use the + concatenator and convert the average to a string)
#Ask the user for another grade (no prompt), convert it to an integer and assign it to a new variable name
#replace the third grade in the list with the most recently entered grade (Tip, you'll need to use the index)
#remove the second grade from the list (Tip, you'll need to use the index and the pop method)
#update the tuple to reflect these recent changes to the list (Tip: replace the entire tuple with the converted list)
#compute the current average grade using the tuple (Tip: divide the tuple sum by the tuple length)
#Display the latest average that you calculated in the previous line using the following format:
#Your updated score is: [calculated average]. (Tip: use the + concatenator and convert the average to a string)
#Display the following statement using the + concatenator using the latest values for sum, length and average:
#(Tip: make sure all the three variables have been converted to strings)
#With a total of [sum of tuple] for [length of tuple] assignments your average score is [tuple average]!

Solutions

Expert Solution

#Create and assign the following list of numbers to a list data type and variable name: 88.5, 90, 75, 70, 85.6
grades=[88.5, 90, 75, 70, 85.6]
#convert the list to a tuple and assign the tuple a different variable name
gradesTuple = tuple(grades)
#Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name
grade=float(input())
#append the user entered grade to the list
grades.append(grade)
#update the tuple to reflect the user entered grade (Tip, replace the entire tuple with the list converted to a tuple)
gradesTuple = tuple(grades)
#compute the current average grade using the tuple
avgGrade=sum(gradesTuple)/len(gradesTuple)
#Display the average that you calculated in the previous line using the following format:
#Your average score is [calculated average]. (Tip: use the + concatenator and convert the average to a string)
print('Your average score is '+str(avgGrade))
#Ask the user for another grade (no prompt), convert it to an integer and assign it to a new variable name
grade=int(input())
#replace the third grade in the list with the most recently entered grade (Tip, you'll need to use the index)
grades[2]=grade
#remove the second grade from the list (Tip, you'll need to use the index and the pop method)
grades.pop(1)
#update the tuple to reflect these recent changes to the list (Tip: replace the entire tuple with the converted list)
gradesTuple = tuple(grades)
#compute the current average grade using the tuple (Tip: divide the tuple sum by the tuple length)
avgGrade=sum(gradesTuple)/len(gradesTuple)
#Display the latest average that you calculated in the previous line using the following format:
#Your updated score is: [calculated average]. (Tip: use the + concatenator and convert the average to a string)
print('Your updated score is '+str(avgGrade))
#Display the following statement using the + concatenator using the latest values for sum, length and average:
#(Tip: make sure all the three variables have been converted to strings)
#With a total of [sum of tuple] for [length of tuple] assignments your average score is [tuple average]!
print('With a total of '+str(sum(gradesTuple))+' for '+str(len(gradesTuple))+" assignments your average score is "+str(avgGrade)+"!")


Related Solutions

Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion...
Python Programming- Practice Lists & Tuples B #This is a template for practicing mutability and conversion #Create and assign the following list of numbers to a list data type and variable name: 99.9,88.7,89,90,100 #convert the list to a tuple and assign the tuple a different variable name #Ask the user for a grade and convert it to a float type (no prompt) and assign it to a new variable name #append the user entered grade to the list #update the...
Python Programming- 9.12 S80 MT Practice 2 """ Enhance your simple food receipt a. Ask the...
Python Programming- 9.12 S80 MT Practice 2 """ Enhance your simple food receipt a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each question mark]. Do not forget to assign each user entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each set of input statements): Name 1? [add a space after the question mark]...
Python Programming- 9.10 MT Practice Simple Food Receipt 2B """ Enhance your simple food receipt a....
Python Programming- 9.10 MT Practice Simple Food Receipt 2B """ Enhance your simple food receipt a. Ask the user for inputs about two food items using the following prompts in turn [add a space after each question mark]. Do not forget to assign each user entry to a unique variable name (do not display the Note to add a space just use print() to add a space between each set of input statements): Item 1? [add a space after the...
The programming language is Python Instructions: Create a function that will delete a node in a...
The programming language is Python Instructions: Create a function that will delete a node in a Linked List based on position number. On below example, if you want to delete position #2, it will remove the Banana (arrangement of nodes below is Apple, Banana, Cherry, Grapes, Orange). myLinkedList = LinkedList() myLinkedList.append("Banana") myLinkedList.append("Cherry") myLinkedList.append("Grapes") myLinkedList.append("Orange") myLinkedList.prepend("Apple") myLinkedList.deleteByPositionNum(2) node = myLinkedList.head while node: print(node.value, " ") node = node.next_node You may start with the function head: def deleteByPositionNum(self, positionNum):
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and...
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and labels and an overall theme. # Meet the chatbot Eve print('Hi there! Welcome to the ChatBot station. I am going to ask you a series of questions and all you have to do is answer!') print(' ') print('Lets get started') #begin questions firstName = input('What is your first name?: ') lastName = input('What is your last name? ') print("Hi there, ", firstName + lastName,...
In this programming challenge you are to create two Python programs: randomwrite.py and randomread.py. One program,...
In this programming challenge you are to create two Python programs: randomwrite.py and randomread.py. One program, randomwrite.py, is to write a set of random numbers to a file. The second program, randomread.py, is to read a set of random numbers from a file, counts how many were read, displays the random numbers, and displays the total count of random numbers. Random Number File Writer (randomwrite.py) Create a program called randomwrite.py that writes a series of random integers to a file....
Create java Class with name Conversion. Instructions for Conversion class: The Conversion class will contain methods...
Create java Class with name Conversion. Instructions for Conversion class: The Conversion class will contain methods designed to perform simple conversions. Specifically, you will be writing methods to convert temperature between Fahrenheit and Celsius and length between meters and inches and practicing overloading methods. See the API document for the Conversion class for a list of the methods you will write. Also, because all of the methods of the Conversion class will be static, you should ensure that it is...
(Python) Write a code converting degrees in Fahrenheit to degrees Kelvin, using this conversion equation conversion...
(Python) Write a code converting degrees in Fahrenheit to degrees Kelvin, using this conversion equation conversion from degrees Fahrenheit to Celcius: ? = (? − 32) x 5/9 and then to degrees Kelvin: ? = ? + 273.15 with the following properties 1) the code should take into account that temperature in degrees Kelvin cannot be smaller than zero. In other words, your code should return 0 Kelvin as the smallest temperature for any input value of degrees Fahrenheit). 2)...
Excel HW 4: Fox Lake Networking Template Objective: Create a template to estimate the cost of...
Excel HW 4: Fox Lake Networking Template Objective: Create a template to estimate the cost of networking Fox Lake Country Club. Skills: IF, AND, OR, COUNT, COUNTA, and COUNTIF and Conditional formatting For the past year, members at Fox Lake Country Club have been complaining about not being able to access the Internet or slow data transmission speeds while at the club. Given your knowledge of spreadsheets, Jeff Lewis, business manager at Fox Lake, has asked you to create an...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT