Question

In: Computer Science

Python: High school assignment, please keep simple In python: Use the following initializer list to create...

Python: High school assignment, please keep simple

In python:

Use the following initializer list to create an array:

twainQuotes = ["I have never let my schooling interfere with my education.",
    "Get your facts first, and then you can distort them as much as you please.",
    "If you tell the truth, you don't have to remember anything.",
    "The secret of getting ahead is getting started.",
    "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]

Use array functions to sort the quotes. Use functions like extend, insert, pop, remove, sort

Then insert the quote "Courage is resistance to fear, mastery of fear, not absence of fear." at the correct spot alphabetically. Then reprint the quotes.

Sample Run

['I have never let my schooling interfere with my education.', 'Get your facts first, and then you can distort them as much as you please.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.', "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]
["Age is an issue of mind over matter. If you don't mind, it doesn't matter. ", 'Get your facts first, and then you can distort them as much as you please.', 'I have never let my schooling interfere with my education.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.']
["Age is an issue of mind over matter. If you don't mind, it doesn't matter. ", 'Courage is resistance to fear, mastery of fear, not absence of fear.', 'Get your facts first, and then you can distort them as much as you please.', 'I have never let my schooling interfere with my education.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.']

Solutions

Expert Solution

twainQuotes = ["I have never let my schooling interfere with my education.",
    "Get your facts first, and then you can distort them as much as you please.",
    "If you tell the truth, you don't have to remember anything.",
    "The secret of getting ahead is getting started.",
    "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]
print(twainQuotes)
twainQuotes.sort()
print(twainQuotes)
twainQuotes.insert(1,"Courage is resistance to fear, mastery of fear, not absence of fear.")
print(twainQuotes)

['I have never let my schooling interfere with my education.', 'Get your facts first, and then you can distort them as much as you please.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.', "Age is an issue of mind over matter. If you don't mind, it doesn't matter. "]
["Age is an issue of mind over matter. If you don't mind, it doesn't matter. ", 'Get your facts first, and then you can distort them as much as you please.', 'I have never let my schooling interfere with my education.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.']
["Age is an issue of mind over matter. If you don't mind, it doesn't matter. ", 'Courage is resistance to fear, mastery of fear, not absence of fear.', 'Get your facts first, and then you can distort them as much as you please.', 'I have never let my schooling interfere with my education.', "If you tell the truth, you don't have to remember anything.", 'The secret of getting ahead is getting started.']


Related Solutions

Please use Python to create a method for a linked list that returns the index of...
Please use Python to create a method for a linked list that returns the index of a lookup value within the linked lust
in python please Q1) Create a Singly link list and write Python Programs for the following...
in python please Q1) Create a Singly link list and write Python Programs for the following tasks: a. Delete the first node/item from the beginning of the link list b. Insert a node/item at the end of the link list c. Delete a node/item from a specific position in the link list Q2) Create a Singly link list and write a Python Program for the following tasks: a. Search a specific item in the linked list and return true if...
USE PYTHON Create a single list that contains the following collection of data in the order...
USE PYTHON Create a single list that contains the following collection of data in the order provided: [1121, "Jackie Grainger", 22.22, 1122, "Jignesh Thrakkar", 25.25, 1127, "Dion Green", 28.75, False, 24.32, 1132, "Jacob Gerber", "Sarah Sanderson", 23.45, 1137, True, "Brandon Heck", 1138, 25.84, True, 1152, "David Toma", 22.65, 23.75, 1157, "Charles King", False, "Jackie Grainger", 1121, 22.22, False, 22.65, 1152, "David Toma"] The data above represents employee information exported from an Excel spreadsheet. Whomever typed the data in originally didn't...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the functions defined below. You are expected to re-use these functions in implementing other functions in the file. Include a triple-quoted string at the bottom displaying your output. Here is the starter outline for the homework: a. def count_character(text, char): """ Count the number of times a character occurs in some text. Do not use the count() method. """ return 0 b. def count_sentences(text): """...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the functions defined below. You are expected to re-use these functions in implementing other functions in the file. Include a triple-quoted string at the bottom displaying your output. Here is the starter outline for the homework: g. def big_words(text, min_length=10): """ Return a list of big words whose length is at least min_length """ return [] h. def common_words(text, min_frequency=10): """ Return words occurring at...
Please create a c++ program that will ask a high school group that is made of...
Please create a c++ program that will ask a high school group that is made of 5 to 17 students to sell candies for a fund raiser. There are small boxes that sell for $7 and large ones that sell for $13. The cost for each box is $4 (small box) and $6 (large box). Please ask the instructor how many students ended up participating in the sales drive (must be between 5 and 17). The instructor must input each...
Please create a C++ program that will ask a high school group that is made of...
Please create a C++ program that will ask a high school group that is made of 5 to 17 students to sell candies for a fund raiser. There are small boxes that sell for $7 and large ones that sell for $13. The cost for each box is $4 (small box) and $6 (large box). Please ask the instructor how many students ended up participating in the sales drive (must be between 5 and 17). The instructor must input each...
Python Please Define a class that has one data attribute of type float. The initializer does...
Python Please Define a class that has one data attribute of type float. The initializer does not accept an argument, however, it initializes the data attribute to zero. Include in class the following methods: 1. func that will accept as two arguments. The first argument a value of float type and the second argument if string. The function will perform the following depending on the string argument: a. if string is '+', the first argument will be added to the...
USE C++ and please keep program as simple as possible and also comment so it is...
USE C++ and please keep program as simple as possible and also comment so it is easy to understad Create a structure called time. Its three members, all type int, should be called hours, minutes, and seconds. Write a program that prompts the user to enter a time value in hours, minutes, and seconds. This should be in 12:59:59 format. This entire input should be assigned first to a string variable. Then the string should be tokenized thereby assigning the...
Assignment: The Ordered List In this assignment, you will create an ordered list of movies. The...
Assignment: The Ordered List In this assignment, you will create an ordered list of movies. The list will always be maintained in sorted order (ascending order, by movie title) by assuring that all new movies are inserted in the correct location in the list. Create a new project to hold your implementation of an ordered singly-linked list. You will need a main.cppto use as a test driver, as well as header and implementation files as described below. Movie To represent...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT