SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
CS 1314: Introduction to Programming and Problem Solving home
>
8.23: Ch. 8 Lab: Word frequencies (dictionaries)
library_books
zyBooks catalog
8.23 Ch. 8 Lab: Word frequencies (dictionaries)
Implement the build_dictionary() function to build a word frequency dictionary from a list of
words.
Ex: If the words list is:
the dictionary returned from calling build_dictionary(words) is:
{'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1}
Ex: If the words list is:
["zyBooks", "now", "zyBooks", "later", "zyBooks", "forever"]
the dictionary returned from calling build_dictionary(words) is:
{'zyBooks': 3, 'now': 1, 'later': 1, 'forever': 1}
The main code builds the word list from an input string, calls build_dictionary() to build the
dictionary, and displays the dictionary sorted by key value.
Ex: If the input is:
hey hi Mark hi mark
the output is:
python please main.py Load default template...

Mais conteúdo relacionado

Semelhante a CS 1314 Introduction to Programming and Problem Solving home8..pdf

第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
anzhong70
 

Semelhante a CS 1314 Introduction to Programming and Problem Solving home8..pdf (20)

Python for Dummies
Python for DummiesPython for Dummies
Python for Dummies
 
Class 31: Deanonymizing
Class 31: DeanonymizingClass 31: Deanonymizing
Class 31: Deanonymizing
 
Commit2015 kharchenko - python generators - ext
Commit2015   kharchenko - python generators - extCommit2015   kharchenko - python generators - ext
Commit2015 kharchenko - python generators - ext
 
13. Java text processing
13.  Java text processing13.  Java text processing
13. Java text processing
 
第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
 
Rethinkdb
RethinkdbRethinkdb
Rethinkdb
 
An introduction to Ruby
An introduction to RubyAn introduction to Ruby
An introduction to Ruby
 
Sixth session
Sixth sessionSixth session
Sixth session
 
Farhana shaikh webinar_dictionaries
Farhana shaikh webinar_dictionariesFarhana shaikh webinar_dictionaries
Farhana shaikh webinar_dictionaries
 
Shell programming
Shell programmingShell programming
Shell programming
 
Python crush course
Python crush coursePython crush course
Python crush course
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Crystal presentation in NY
Crystal presentation in NYCrystal presentation in NY
Crystal presentation in NY
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
Information Retrieval-05(wild card query_positional index_spell correction)
Information Retrieval-05(wild card query_positional index_spell correction)Information Retrieval-05(wild card query_positional index_spell correction)
Information Retrieval-05(wild card query_positional index_spell correction)
 
201705 metaprogramming in julia
201705 metaprogramming in julia201705 metaprogramming in julia
201705 metaprogramming in julia
 
What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?
 
Unit vii wp ppt
Unit vii wp pptUnit vii wp ppt
Unit vii wp ppt
 
JDK1.7 features
JDK1.7 featuresJDK1.7 features
JDK1.7 features
 

Mais de ameerandsons

cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdfcultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
ameerandsons
 
Cuando una encuesta mide el compromiso de los empleados de una organ.pdf
Cuando una encuesta mide el compromiso de los empleados de una organ.pdfCuando una encuesta mide el compromiso de los empleados de una organ.pdf
Cuando una encuesta mide el compromiso de los empleados de una organ.pdf
ameerandsons
 
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdfCuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
ameerandsons
 
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdfCuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
ameerandsons
 
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdfCS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
ameerandsons
 

Mais de ameerandsons (20)

Culturas de mercado A) Empoderar a los empleados para que asuman .pdf
Culturas de mercado A) Empoderar a los empleados para que asuman .pdfCulturas de mercado A) Empoderar a los empleados para que asuman .pdf
Culturas de mercado A) Empoderar a los empleados para que asuman .pdf
 
Current Event #2 - summarize a recent business article from a source.pdf
Current Event #2 - summarize a recent business article from a source.pdfCurrent Event #2 - summarize a recent business article from a source.pdf
Current Event #2 - summarize a recent business article from a source.pdf
 
cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdfcultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
cultura y diversidad 1. Paralenguaje se refiere a a. Contacto vi.pdf
 
Cryptography13.Consider the following matrix with entries from E,.pdf
Cryptography13.Consider the following matrix with entries from E,.pdfCryptography13.Consider the following matrix with entries from E,.pdf
Cryptography13.Consider the following matrix with entries from E,.pdf
 
Cuatro tendencias principales que afectan el comercio mundial a prin.pdf
Cuatro tendencias principales que afectan el comercio mundial a prin.pdfCuatro tendencias principales que afectan el comercio mundial a prin.pdf
Cuatro tendencias principales que afectan el comercio mundial a prin.pdf
 
Cuando una encuesta mide el compromiso de los empleados de una organ.pdf
Cuando una encuesta mide el compromiso de los empleados de una organ.pdfCuando una encuesta mide el compromiso de los empleados de una organ.pdf
Cuando una encuesta mide el compromiso de los empleados de una organ.pdf
 
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdfCuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
Cuenta Saldo 31122013 Saldo 31122014 Depreciaci�n acumulada $2.pdf
 
Cuando una empresa instala filiales que producen algunos de los insu.pdf
Cuando una empresa instala filiales que producen algunos de los insu.pdfCuando una empresa instala filiales que producen algunos de los insu.pdf
Cuando una empresa instala filiales que producen algunos de los insu.pdf
 
Cuando un proceso no est� bajo control que significa No est� haci.pdf
Cuando un proceso no est� bajo control que significa No est� haci.pdfCuando un proceso no est� bajo control que significa No est� haci.pdf
Cuando un proceso no est� bajo control que significa No est� haci.pdf
 
Cuando un proyectil (una roca del espacio, digamos) golpea la superf.pdf
Cuando un proyectil (una roca del espacio, digamos) golpea la superf.pdfCuando un proyectil (una roca del espacio, digamos) golpea la superf.pdf
Cuando un proyectil (una roca del espacio, digamos) golpea la superf.pdf
 
Cuando se trata de evaluaciones de desempe�o, los supervisores y los.pdf
Cuando se trata de evaluaciones de desempe�o, los supervisores y los.pdfCuando se trata de evaluaciones de desempe�o, los supervisores y los.pdf
Cuando se trata de evaluaciones de desempe�o, los supervisores y los.pdf
 
Cuando los lobos regresaron por primera vez a Yellowstone, las pobla.pdf
Cuando los lobos regresaron por primera vez a Yellowstone, las pobla.pdfCuando los lobos regresaron por primera vez a Yellowstone, las pobla.pdf
Cuando los lobos regresaron por primera vez a Yellowstone, las pobla.pdf
 
Cuando Joe maximiza la utilidad, encuentra que su MRS de X por Y (o .pdf
Cuando Joe maximiza la utilidad, encuentra que su MRS de X por Y (o .pdfCuando Joe maximiza la utilidad, encuentra que su MRS de X por Y (o .pdf
Cuando Joe maximiza la utilidad, encuentra que su MRS de X por Y (o .pdf
 
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdfCuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
Cuando el suministro es de inter�s p�blico Roche y Tamiflu El caso .pdf
 
Cuando escuchas la palabra liderazgo, �qu� te viene a la mente Co.pdf
Cuando escuchas la palabra liderazgo, �qu� te viene a la mente Co.pdfCuando escuchas la palabra liderazgo, �qu� te viene a la mente Co.pdf
Cuando escuchas la palabra liderazgo, �qu� te viene a la mente Co.pdf
 
Cuando el fago lambda de tipo salvaje se sembra en placas en un c�sp.pdf
Cuando el fago lambda de tipo salvaje se sembra en placas en un c�sp.pdfCuando el fago lambda de tipo salvaje se sembra en placas en un c�sp.pdf
Cuando el fago lambda de tipo salvaje se sembra en placas en un c�sp.pdf
 
Cualquier ayuda es bienvenida. Jayne Butterfield, una madre solter.pdf
Cualquier ayuda es bienvenida. Jayne Butterfield, una madre solter.pdfCualquier ayuda es bienvenida. Jayne Butterfield, una madre solter.pdf
Cualquier ayuda es bienvenida. Jayne Butterfield, una madre solter.pdf
 
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdfCS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
 
Cross-cultural industrial and organizational psychology. Citation Tr.pdf
Cross-cultural industrial and organizational psychology. Citation Tr.pdfCross-cultural industrial and organizational psychology. Citation Tr.pdf
Cross-cultural industrial and organizational psychology. Citation Tr.pdf
 
Cryptography is designed to turn information into a format that is d.pdf
Cryptography is designed to turn information into a format that is d.pdfCryptography is designed to turn information into a format that is d.pdf
Cryptography is designed to turn information into a format that is d.pdf
 

Último

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

CS 1314 Introduction to Programming and Problem Solving home8..pdf

  • 1. CS 1314: Introduction to Programming and Problem Solving home > 8.23: Ch. 8 Lab: Word frequencies (dictionaries) library_books zyBooks catalog 8.23 Ch. 8 Lab: Word frequencies (dictionaries) Implement the build_dictionary() function to build a word frequency dictionary from a list of words. Ex: If the words list is: the dictionary returned from calling build_dictionary(words) is: {'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1} Ex: If the words list is: ["zyBooks", "now", "zyBooks", "later", "zyBooks", "forever"] the dictionary returned from calling build_dictionary(words) is: {'zyBooks': 3, 'now': 1, 'later': 1, 'forever': 1} The main code builds the word list from an input string, calls build_dictionary() to build the dictionary, and displays the dictionary sorted by key value. Ex: If the input is: hey hi Mark hi mark the output is: python please main.py Load default template...