
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Implement your algorithm as Python code. This must match the steps of your algorithm and you should use comments in the code to make it clear how the two correspond. Marks will be lost if the program does not follow the algorithm. Your code should include a comment that gives your PI number. Copy your Python code, as text, for this second task into your Solution document. Name your Python file Q2b_OUCU.py, where ‘OUCU’ is your OU computer username, e.g. abc123. Then include the code file in your TMA.zip file.
You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM112 does not cover, you must give a justification for your decisions, otherwise marks will be lost.
![18:59
TMA 02
No 41%
the input list.
In order to test your code you should also add the
step
>> print the new list
In order to test this part of your program, you will
create a binary number based on your Pl. [Your Pl
is the long number that starts with a letter,
followed by either seven digits or 6 digits and an
X].
Perform the following steps with pen and paper -
you should not write code for these steps:
For each of the first 6 digits in your Pl, create an
input list of 1s and Os of length 6 as follows:
If a digit in your Pl is even, append 0 to the input
list, if it is odd, append 1 to the input list.
For example, for the PI B0381720, the first six
digits (in order) are even (0), odd (3), even (8), odd
(1), odd (7), even (2).
So your input list would be [0,1,0,1,1,0]
The list of conversion values for converting binary
to decimal will always be [32, 16, 8, 4, 2, 1].
So the input list [0,1,0,1,1,0] would result in the
output list [16, 4, 2].
|||](https://content.bartleby.com/qna-images/question/98d014f4-d7c3-4331-98d7-2a50cf9bf0ce/7e561016-4e5a-471f-b789-472dd266f5b0/c4ogtnb_thumbnail.jpeg)
Transcribed Image Text:18:59
TMA 02
No 41%
the input list.
In order to test your code you should also add the
step
>> print the new list
In order to test this part of your program, you will
create a binary number based on your Pl. [Your Pl
is the long number that starts with a letter,
followed by either seven digits or 6 digits and an
X].
Perform the following steps with pen and paper -
you should not write code for these steps:
For each of the first 6 digits in your Pl, create an
input list of 1s and Os of length 6 as follows:
If a digit in your Pl is even, append 0 to the input
list, if it is odd, append 1 to the input list.
For example, for the PI B0381720, the first six
digits (in order) are even (0), odd (3), even (8), odd
(1), odd (7), even (2).
So your input list would be [0,1,0,1,1,0]
The list of conversion values for converting binary
to decimal will always be [32, 16, 8, 4, 2, 1].
So the input list [0,1,0,1,1,0] would result in the
output list [16, 4, 2].
|||
![18:59
TMA 02
No 41%
the input list.
In order to test your code you should also add the
step
>> print the new list
In order to test this part of your program, you will
create a binary number based on your Pl. [Your Pl
is the long number that starts with a letter,
followed by either seven digits or 6 digits and an
X].
Perform the following steps with pen and paper -
you should not write code for these steps:
For each of the first 6 digits in your Pl, create an
input list of 1s and Os of length 6 as follows:
If a digit in your Pl is even, append 0 to the input
list, if it is odd, append 1 to the input list.
For example, for the PI B0381720, the first six
digits (in order) are even (0), odd (3), even (8), odd
(1), odd (7), even (2).
So your input list would be [0,1,0,1,1,0]
The list of conversion values for converting binary
to decimal will always be [32, 16, 8, 4, 2, 1].
So the input list [0,1,0,1,1,0] would result in the
output list [16, 4, 2].
|||](https://content.bartleby.com/qna-images/question/98d014f4-d7c3-4331-98d7-2a50cf9bf0ce/7e561016-4e5a-471f-b789-472dd266f5b0/xwwr4vzb_thumbnail.jpeg)
Transcribed Image Text:18:59
TMA 02
No 41%
the input list.
In order to test your code you should also add the
step
>> print the new list
In order to test this part of your program, you will
create a binary number based on your Pl. [Your Pl
is the long number that starts with a letter,
followed by either seven digits or 6 digits and an
X].
Perform the following steps with pen and paper -
you should not write code for these steps:
For each of the first 6 digits in your Pl, create an
input list of 1s and Os of length 6 as follows:
If a digit in your Pl is even, append 0 to the input
list, if it is odd, append 1 to the input list.
For example, for the PI B0381720, the first six
digits (in order) are even (0), odd (3), even (8), odd
(1), odd (7), even (2).
So your input list would be [0,1,0,1,1,0]
The list of conversion values for converting binary
to decimal will always be [32, 16, 8, 4, 2, 1].
So the input list [0,1,0,1,1,0] would result in the
output list [16, 4, 2].
|||
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Python: Data = [ { "creatt": "2022-02-28T13:05:24" }, { "creat": "2022-02-21T23:49:33" }, { "creat": "2022-02-21T11:08:23" }, { "creat": "2022-02-19T10:06:46", "xxx": [ "23", "1", "9" ] }, { "creat": "2022-01-25T13:12:49", "xxx": [ "2" ] } ] How to count "xxx": ["23", "1", "9"] and "xxx": ["2"], then the total should be 4. I would like to return the 4. my desired code: { "total": 4 }arrow_forwardA Python dictionary that returns a list of values for each key. The dictionary will contain information about my favorite books, including the title, author, and year of publication. The key will be the title of the book, and the values will be a list containing the author and the year of publication. favorite_books = { "The Great Gatsby": ["F. Scott Fitzgerald", 1925], "To Kill a Mockingbird": ["Harper Lee", 1960], "1984": ["George Orwell", 1949]} NOTE: You can replace the book details as your need in above code. Next, modify the invert_dict function from Section 11.5 of "Think Python" to invert my dictionary. The modified function will need to turn each of the list items into separate keys in the inverted dictionary. def invert_dict(d): inverse = dict() for key in d: vals = d[key] for val in vals: if val not in inverse: inverse[val] = [key] else: inverse[val].append(key) return inverse Here, the…arrow_forwardThe language is Javaarrow_forward
- Using Python build your own song remixing solution. As an example: given the following American children’s song (this is ONE of the 3 songs I’m giving you in the starter code that includes the data you'll use for your program) Starter file: music.py (data file for my songs and playlist) here below; SONG = ['old macdonald had a farm - ee-i-ee-i-o.', 'and on that farm he had a cow - ee-i-ee-i-o.', 'with a moo moo here and a moo moo there', 'here a moo - there a moo - everywhere a moo moo', 'old macdonald had a farm - ee-i-ee-i-o.' ] Do This: Create a solution that allows users to: Load a new song from our playlist When requested, show the title of the song you’re currently remixing Continue the above operations on demand, until the user explicitly quits your program. Note that there is punctuation in some of the songs we've given you. When you remix a song, you should remove the punctuation (see the example reverse below). If you are unable to perform…arrow_forwardI need to create a program with python that will generate a password using a domain name the user has inputted. It will then use an algorithm that will alphabetize the domain name, capitalize all vowels, and add a number at the end the length of a domain name. I need to use loops and selection structures to implement the algorithm. The end will look like this: facebook>AbcEfOOk8 amazon>AAmnOz6arrow_forwardPlease help (on jupyter note in python) Homecoming Shopping ListWe bought the following souvenirs for homecoming gathering: 5 shirts ( $ 10/item), $ 10 Polo Shirts ( $ 20.75/item), 5 trousers ( $ 29.95/item), 10 caps ( $ 11.95/item), 20 pens ( $ 1.99/item), 20 hoodies ( $ 24.95/item), and 30 chocoloates ( $ 2.95/item). Use Dot Product and NumPy arrays to compute the total cost of Homecoming.arrow_forward
- please use a picture and your own code for explenations please. thank youarrow_forwardCreate a program that generates an eight-digit account number. The program should generate eight random numbers, each in the range of 0 to 9, and assign each number to a list element. Then write another loop that displays the entire contents of the list without the []. use pythonarrow_forwardTry to create a dictionary that has a listing of people and includes one interesting fact about each of them. Display each person and their interesting fact on the screen. From there, alter a fact about one of the people on the list. Also, add an extra person and corresponding fact to the list. Display the newly created list of people and facts. Try running the program multiple times and take note of whether the order changes. Sample output: Jeff: Was born in France. David: Was a mascot in college. Anna: Has arachnophobia. Dylan: Has a pet hedgehog. Jeff: Was born in France. David: Can juggle. Anna: Has arachnophobia. Code Listing 209 106arrow_forward
- Using a random number generator, create a list of 500 integers in Python. Perform a benchmark analysis using some of the sorting algorithms from this module. What is the difference in execution speed between the different sorting algorithms and why? In your paper, be sure to provide a brief discussion of the sorting algorithms used in this activity. Your paper should be 2-3 pages in length (not including title and references pages) and conform to APA guidelinesarrow_forwardWrite a code in python for this exercise belowarrow_forward1. Consider the loop from Section 8.3 of your textbook. prefixes = 'JKLMNOPQ'suffix = 'ack' for letter in prefixes: print(letter + suffix) Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack". Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same. Include the modified Python code and the output in your submission. 2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example. Invent your own examples. Do not copy them for the textbook or any other source. The code and its output must be explained technically. The explanation can be provided before or after the code, or in the form of comments within the code. For code modification type of questions, always mention or clearly highlight the part which is modified, along with the reason stated, as a code comment. The descriptive part of your response must be at least 200 words. If you…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education