SlideShare a Scribd company logo
1 of 2
Download to read offline
Assignment:
Modify the Python program by adding the create_dictionary function. The parameter file_name
is the name of the csv file that contains several lines of ASCII encodings. The format of this file
is described in the link above. The function should return a dictionary where the keys are
characters and the values are the 8 bit representations. Note: use the characters for comma, quote,
and space characters, instead of the words comma, quote, and space.
Add the translate function. The parameter sentence consists of a number of characters. The
parameter dictionary is the dictionary returned by the create_dictionary function. The parameter
file_name is the name of the output file where all output should be sent. In the output file, the
text should be a binary string (zeros and ones only) with each 8 bit ascii code appearing one after
the other. (see sample transcripts)
If a character does not appear in the dictionary, the string "nUNDEFINEDn" should appear
instead of an 8 bit representation.
When the program is run, it should produce the following three output files: output-1.txt, output-
2.txt and output-3.txt.
Grading:
2 points - The create_dictionary function returns a dictionary that contains the correct binary
code for each character of length one.
1 point - The create_dictionary function returns a dictionary that contains the correct binary code
for comma, quote, and space.
3 points - When your program is tested with different values for the variable sentence, all
characters that exist in the dictionary are translated correctly.
1 point - When your program is tested with different values for the variable sentence, characters
that do NOT exist in the dictionary are translated correctly to the word UNDEFINED on a line of
its own.
1 point - The format of any output files created match the format of the sample output files
exactly. def create_dictionary(f): # f is the filename; rename the parameter as you wish pass #
open the file for reading and assign to a file handle variable* # make a dictionary variable -- it
can be empty to start with # use the file handle variable step through each line doing this.." #
make the line into a list, splitting it up at the commas # optional: temporarily try printing it out.
What you expected? # assign the binary number to a variable as a string # optional: temporarily
try printing it out. What you expected? # assign the character to a variable as a string #
optional: temporarily try printing it out. What you expected? # use the two new variables to add
an entry to the dictionary # optional: temporarily try printing it out. What you expected? #
Note: you will want the comma, space, and quote mark keys to be those actual characters.". #
"make sure that gets handled at some point before returning the dictionary # *don't forget to
close the file # return the dictionary to where it was called from def translate(s, d, f): # rename
the parameters as you wish pass
01000001001000000110110001101111011011100110011100100000011101000110100101101
101011001010010000001100
00101100111011011100100000011010010110111000100000011000010010000001100111011
00001011011000110000101
11100001111001001000000110011001100001011100100010110000100000011001100110000
101110010001000000110000 1011101110110000101111001001011100010111000101110
O0100110101101111011011100111010001100001011011100110000100100000010100110111
0100011000010111010001100
10100100000010101010110111001101001011101100110010101110010011100110110100101
110100011110010010000000
10100000110100001100000011011000101001001000000011001001110010011010000101101
00110000001100100011000 100110001
NDEFINED
O1010100011100100111010101100101001000000110011001110010011010010110010101101
110011001000111001100100
00011100110111010001100001011000100010000001110010110111011101010010000001101
001011011100010000001
10100011010000110010100100000011001100111001001101111011011100111010000101110
NDEFINED 0100000 NDEFINED 101011101101001011011000110010001100101

More Related Content

Similar to AssignmentModify the Python program by adding the create_dictiona.pdf

functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...Osama Ghandour Geris
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide shareDevashish Kumar
 
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdf
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdfInstructionYou’ll probably want to import FileReader, PrintWriter,.pdf
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdfarsmobiles
 
101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressionsAcácio Oliveira
 
Arrays & functions in php
Arrays & functions in phpArrays & functions in php
Arrays & functions in phpAshish Chamoli
 
INSTRUCTIONS For this assignment you will be generating all code on y.pdf
 INSTRUCTIONS For this assignment you will be generating all code on y.pdf INSTRUCTIONS For this assignment you will be generating all code on y.pdf
INSTRUCTIONS For this assignment you will be generating all code on y.pdfadayarboot
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceKrithikaTM
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Techglyphs
 
String & path functions in vba
String & path functions in vbaString & path functions in vba
String & path functions in vbagondwe Ben
 
Userdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfUserdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfDeeptiMalhotra19
 
String Interpolation in Scala
String Interpolation in ScalaString Interpolation in Scala
String Interpolation in ScalaKnoldus Inc.
 
Python_Unit_III.pptx
Python_Unit_III.pptxPython_Unit_III.pptx
Python_Unit_III.pptxssuserc755f1
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaSynesso
 

Similar to AssignmentModify the Python program by adding the create_dictiona.pdf (20)

functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdf
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdfInstructionYou’ll probably want to import FileReader, PrintWriter,.pdf
InstructionYou’ll probably want to import FileReader, PrintWriter,.pdf
 
101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions
 
Arrays & functions in php
Arrays & functions in phpArrays & functions in php
Arrays & functions in php
 
INSTRUCTIONS For this assignment you will be generating all code on y.pdf
 INSTRUCTIONS For this assignment you will be generating all code on y.pdf INSTRUCTIONS For this assignment you will be generating all code on y.pdf
INSTRUCTIONS For this assignment you will be generating all code on y.pdf
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer Science
 
Latex Tutorial
Latex TutorialLatex Tutorial
Latex Tutorial
 
Python unit 1 (1).pptx
Python unit 1 (1).pptxPython unit 1 (1).pptx
Python unit 1 (1).pptx
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2
 
latest slide
latest slidelatest slide
latest slide
 
testing add
testing addtesting add
testing add
 
String & path functions in vba
String & path functions in vbaString & path functions in vba
String & path functions in vba
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Shanks
ShanksShanks
Shanks
 
Userdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdfUserdefined functions brief explaination.pdf
Userdefined functions brief explaination.pdf
 
String Interpolation in Scala
String Interpolation in ScalaString Interpolation in Scala
String Interpolation in Scala
 
7986-lect 7.pdf
7986-lect 7.pdf7986-lect 7.pdf
7986-lect 7.pdf
 
Python_Unit_III.pptx
Python_Unit_III.pptxPython_Unit_III.pptx
Python_Unit_III.pptx
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 

More from tsekar2004

Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdf
Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdfAplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdf
Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdftsekar2004
 
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdf
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdfAplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdf
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdftsekar2004
 
AO= Actual Quantity.pdf
AO= Actual Quantity.pdfAO= Actual Quantity.pdf
AO= Actual Quantity.pdftsekar2004
 
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdf
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdfAn�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdf
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdftsekar2004
 
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdf
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdfAn�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdf
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdftsekar2004
 
answer these two questions 1 . why are brand marketers concerned.pdf
answer these two questions  1 . why are brand marketers concerned.pdfanswer these two questions  1 . why are brand marketers concerned.pdf
answer these two questions 1 . why are brand marketers concerned.pdftsekar2004
 
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdf
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdfAn�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdf
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdftsekar2004
 
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdf
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdfAntes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdf
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdftsekar2004
 
answers arent clear d. Residents of Lilliput .pdf
answers arent clear  d. Residents of Lilliput .pdfanswers arent clear  d. Residents of Lilliput .pdf
answers arent clear d. Residents of Lilliput .pdftsekar2004
 
answerhelp with 13 14 and. short reflection 13. What gene is m.pdf
answerhelp with 13 14 and. short reflection 13. What gene is m.pdfanswerhelp with 13 14 and. short reflection 13. What gene is m.pdf
answerhelp with 13 14 and. short reflection 13. What gene is m.pdftsekar2004
 
AssignmentPrepare a vulnerability scanning report that will be pre.pdf
AssignmentPrepare a vulnerability scanning report that will be pre.pdfAssignmentPrepare a vulnerability scanning report that will be pre.pdf
AssignmentPrepare a vulnerability scanning report that will be pre.pdftsekar2004
 
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdf
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdfAnswer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdf
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdftsekar2004
 
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdf
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdfAnswer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdf
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdftsekar2004
 
Answer the questions about the instructions Topic Pregnancychoos.pdf
Answer the questions about the instructions Topic Pregnancychoos.pdfAnswer the questions about the instructions Topic Pregnancychoos.pdf
Answer the questions about the instructions Topic Pregnancychoos.pdftsekar2004
 
Assessment Description You are required to do the modelli.pdf
Assessment Description  You are required to do the modelli.pdfAssessment Description  You are required to do the modelli.pdf
Assessment Description You are required to do the modelli.pdftsekar2004
 
Assignment2 (driver class) Agency reference to the Agency class pub.pdf
Assignment2 (driver class) Agency reference to the Agency class pub.pdfAssignment2 (driver class) Agency reference to the Agency class pub.pdf
Assignment2 (driver class) Agency reference to the Agency class pub.pdftsekar2004
 
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdf
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdfAssignment-2 on Windows Server Administration (Note Partial Marks a.pdf
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdftsekar2004
 
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdf
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdfAssignment Introduction to AWS Iot and Cloud StorageInstructions.pdf
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdftsekar2004
 
Assignment DetailsThe board of Trustees of an organization tasked .pdf
Assignment DetailsThe board of Trustees of an organization tasked .pdfAssignment DetailsThe board of Trustees of an organization tasked .pdf
Assignment DetailsThe board of Trustees of an organization tasked .pdftsekar2004
 
Assignment on Pen testing1. Executive Summary(Which PT is rele.pdf
Assignment on Pen testing1.   Executive Summary(Which PT is rele.pdfAssignment on Pen testing1.   Executive Summary(Which PT is rele.pdf
Assignment on Pen testing1. Executive Summary(Which PT is rele.pdftsekar2004
 

More from tsekar2004 (20)

Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdf
Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdfAplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdf
Aplicar el Cap�tulo 11 de Bancarrota a Community Choice Financial In.pdf
 
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdf
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdfAplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdf
Aplicando Lecciones Aprendidas(identificar-documento -Analizar-A.pdf
 
AO= Actual Quantity.pdf
AO= Actual Quantity.pdfAO= Actual Quantity.pdf
AO= Actual Quantity.pdf
 
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdf
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdfAn�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdf
An�lisis FODA para una dulcer�a local saludable con fortalezas exter.pdf
 
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdf
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdfAn�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdf
An�lisis de Shoe Corporation of Illinois. Analice la estructura or.pdf
 
answer these two questions 1 . why are brand marketers concerned.pdf
answer these two questions  1 . why are brand marketers concerned.pdfanswer these two questions  1 . why are brand marketers concerned.pdf
answer these two questions 1 . why are brand marketers concerned.pdf
 
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdf
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdfAn�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdf
An�lisis de caso de desarrollo de liderazgo Pat Talley se puso de .pdf
 
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdf
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdfAntes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdf
Antes de la promulgaci�n de la Ley de Seguridad de los Ingresos de.pdf
 
answers arent clear d. Residents of Lilliput .pdf
answers arent clear  d. Residents of Lilliput .pdfanswers arent clear  d. Residents of Lilliput .pdf
answers arent clear d. Residents of Lilliput .pdf
 
answerhelp with 13 14 and. short reflection 13. What gene is m.pdf
answerhelp with 13 14 and. short reflection 13. What gene is m.pdfanswerhelp with 13 14 and. short reflection 13. What gene is m.pdf
answerhelp with 13 14 and. short reflection 13. What gene is m.pdf
 
AssignmentPrepare a vulnerability scanning report that will be pre.pdf
AssignmentPrepare a vulnerability scanning report that will be pre.pdfAssignmentPrepare a vulnerability scanning report that will be pre.pdf
AssignmentPrepare a vulnerability scanning report that will be pre.pdf
 
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdf
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdfAnswer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdf
Answer is 0.5 Problem 31.6 Let X be a continuous random variable wit.pdf
 
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdf
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdfAnswer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdf
Answer is 0.06 Problem 31.7 Let X have a cdf F(x)={1x610x1�otherwise.pdf
 
Answer the questions about the instructions Topic Pregnancychoos.pdf
Answer the questions about the instructions Topic Pregnancychoos.pdfAnswer the questions about the instructions Topic Pregnancychoos.pdf
Answer the questions about the instructions Topic Pregnancychoos.pdf
 
Assessment Description You are required to do the modelli.pdf
Assessment Description  You are required to do the modelli.pdfAssessment Description  You are required to do the modelli.pdf
Assessment Description You are required to do the modelli.pdf
 
Assignment2 (driver class) Agency reference to the Agency class pub.pdf
Assignment2 (driver class) Agency reference to the Agency class pub.pdfAssignment2 (driver class) Agency reference to the Agency class pub.pdf
Assignment2 (driver class) Agency reference to the Agency class pub.pdf
 
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdf
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdfAssignment-2 on Windows Server Administration (Note Partial Marks a.pdf
Assignment-2 on Windows Server Administration (Note Partial Marks a.pdf
 
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdf
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdfAssignment Introduction to AWS Iot and Cloud StorageInstructions.pdf
Assignment Introduction to AWS Iot and Cloud StorageInstructions.pdf
 
Assignment DetailsThe board of Trustees of an organization tasked .pdf
Assignment DetailsThe board of Trustees of an organization tasked .pdfAssignment DetailsThe board of Trustees of an organization tasked .pdf
Assignment DetailsThe board of Trustees of an organization tasked .pdf
 
Assignment on Pen testing1. Executive Summary(Which PT is rele.pdf
Assignment on Pen testing1.   Executive Summary(Which PT is rele.pdfAssignment on Pen testing1.   Executive Summary(Which PT is rele.pdf
Assignment on Pen testing1. Executive Summary(Which PT is rele.pdf
 

Recently uploaded

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 

Recently uploaded (20)

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 

AssignmentModify the Python program by adding the create_dictiona.pdf

  • 1. Assignment: Modify the Python program by adding the create_dictionary function. The parameter file_name is the name of the csv file that contains several lines of ASCII encodings. The format of this file is described in the link above. The function should return a dictionary where the keys are characters and the values are the 8 bit representations. Note: use the characters for comma, quote, and space characters, instead of the words comma, quote, and space. Add the translate function. The parameter sentence consists of a number of characters. The parameter dictionary is the dictionary returned by the create_dictionary function. The parameter file_name is the name of the output file where all output should be sent. In the output file, the text should be a binary string (zeros and ones only) with each 8 bit ascii code appearing one after the other. (see sample transcripts) If a character does not appear in the dictionary, the string "nUNDEFINEDn" should appear instead of an 8 bit representation. When the program is run, it should produce the following three output files: output-1.txt, output- 2.txt and output-3.txt. Grading: 2 points - The create_dictionary function returns a dictionary that contains the correct binary code for each character of length one. 1 point - The create_dictionary function returns a dictionary that contains the correct binary code for comma, quote, and space. 3 points - When your program is tested with different values for the variable sentence, all characters that exist in the dictionary are translated correctly. 1 point - When your program is tested with different values for the variable sentence, characters that do NOT exist in the dictionary are translated correctly to the word UNDEFINED on a line of its own. 1 point - The format of any output files created match the format of the sample output files exactly. def create_dictionary(f): # f is the filename; rename the parameter as you wish pass # open the file for reading and assign to a file handle variable* # make a dictionary variable -- it can be empty to start with # use the file handle variable step through each line doing this.." # make the line into a list, splitting it up at the commas # optional: temporarily try printing it out. What you expected? # assign the binary number to a variable as a string # optional: temporarily try printing it out. What you expected? # assign the character to a variable as a string # optional: temporarily try printing it out. What you expected? # use the two new variables to add an entry to the dictionary # optional: temporarily try printing it out. What you expected? # Note: you will want the comma, space, and quote mark keys to be those actual characters.". #
  • 2. "make sure that gets handled at some point before returning the dictionary # *don't forget to close the file # return the dictionary to where it was called from def translate(s, d, f): # rename the parameters as you wish pass 01000001001000000110110001101111011011100110011100100000011101000110100101101 101011001010010000001100 00101100111011011100100000011010010110111000100000011000010010000001100111011 00001011011000110000101 11100001111001001000000110011001100001011100100010110000100000011001100110000 101110010001000000110000 1011101110110000101111001001011100010111000101110 O0100110101101111011011100111010001100001011011100110000100100000010100110111 0100011000010111010001100 10100100000010101010110111001101001011101100110010101110010011100110110100101 110100011110010010000000 10100000110100001100000011011000101001001000000011001001110010011010000101101 00110000001100100011000 100110001 NDEFINED O1010100011100100111010101100101001000000110011001110010011010010110010101101 110011001000111001100100 00011100110111010001100001011000100010000001110010110111011101010010000001101 001011011100010000001 10100011010000110010100100000011001100111001001101111011011100111010000101110 NDEFINED 0100000 NDEFINED 101011101101001011011000110010001100101