SlideShare a Scribd company logo
1 of 1
Please program both parts in Python. Please focus on part 2 and print output. Thank You so
much
Problem 3. You are given the following text. In [ ]: M text = "It was dark, like the bottom of a
well. There was a pattern of skulls and bones around I the frame, for the sake of appearances;
Death could not look himself in the skull in a mirror I with cherubs and roses around it. The
Death of Rats climbed the frame in a scrabble of claws and looked at Death expectantly from the
top. Quoth fluttered over and pecked briefly at his own reflection, on the basis that anything was
worth a try. Show me, said Death, show me my thoughts. A chessboard appeared, but it was
triangular, and so big that only the nearest point could be seen. Right on this point was the world
- turtle, elephants, the little orbiting sun and all. It was the I Discworld, which existed only just
this side of total improbability and, therefore, in border country. I In border country the border
gets crossed, and sometimes things creep into the universe that have I rather more on their mind
than a better life for their children and a wonderful future in the fruit picking and domestic
service industries. On every other black or white triangle of the chessboard, all the way to
infinity, was a small grey shape, rather like an empty hooded robe." You are also given a string
that contains all symbols of English alphabet. In [3]: M alphabet =
"abcdefghijklmnopqrstuvwxyz" Part 1. Write some code that generates the list unique_words,
containing all and only the unique lowercase words from text. You should see the following
output (the order can differl): ['a', 'infinity', 'reflection', 'with', 'like', 'big', 'briefly', 'into',
'children', 'which', 'fruit', 'picking', 'ther e', 'try', 'little', 'around', 'appearances', 'appeared', 'all',
'crossed', 'basis', 'improbability', 'their', 'discworl d', 'black', 'to', 'death', 'future', 'only', 'my', 'robe',
'things', 'for', 'it', 'existed', 'said', 'sake', 'sometime s', 'right', 'way', 'that', 'country', 'chessboard',
'quoth', 'well', 'domestic', 'skull', 'wonderful', 'hooded', 'or', 'empty', 'bottom', 'mirror', 'himself',
'rather', 'over', 'every', 'triangle', 'roses', 'border', 'orbiting', 'Was', 'fr om', 'show', 'be', 'pecked',
'bones', 'just', 'universe', 'me', 'triangular', 'gets', 'worth', 'have', 'climbed', 'servi ce', 'fluttered',
'top', 'but', 'grey', 'claws', 'at', 'rats', 'creep', 'own', 'pattern', 'point', 'white', 'than', 'dar k', 'therefore',
'frame', 'this', 'not', 'the', 'could', 'mind', 'turtle', 'scrabble', 'better', 'industries', 'looked', 'an',
'cherubs', 'life', 'anything', 'more', 'small', 'and', 'of', 'his', 'on', 'sku1ls', 'elephants', 'in', 'thoughts',
'seen', 'nearest', 'expectantly', 'other', 'side', 'shape', 'total', 'so', 'world', 'look', 'sun'] In [ ]: M Part
2. Write a program which generates the list bigrams, collect all attested bigrams in Ignore words
that are shorter than 2 characters. Make sure that the list bigrams does not contain duplicates.
Hint. You can use the code to extract bigrams you wrote above. Then, you need to have that code
iterate over each word in the list and add a check for duplicates! In [ ]: M

More Related Content

More from AustinaGRPaigey

please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
 
please answer all questions to the activites- The study of genetics an.docx
please answer all questions to the activites- The study of genetics an.docxplease answer all questions to the activites- The study of genetics an.docx
please answer all questions to the activites- The study of genetics an.docx
AustinaGRPaigey
 

More from AustinaGRPaigey (20)

PLEASE USE C+ language Q2- Let- a number that is divisible by 11 is ca (1).docx
PLEASE USE C+ language Q2- Let- a number that is divisible by 11 is ca (1).docxPLEASE USE C+ language Q2- Let- a number that is divisible by 11 is ca (1).docx
PLEASE USE C+ language Q2- Let- a number that is divisible by 11 is ca (1).docx
 
please show your work so I can follow and answer later questions on my.docx
please show your work so I can follow and answer later questions on my.docxplease show your work so I can follow and answer later questions on my.docx
please show your work so I can follow and answer later questions on my.docx
 
PLEASE HELP!! Which are affiliate of audit client Port Co A and which.docx
PLEASE HELP!! Which are affiliate of audit client Port Co A and which.docxPLEASE HELP!! Which are affiliate of audit client Port Co A and which.docx
PLEASE HELP!! Which are affiliate of audit client Port Co A and which.docx
 
Please Help!!! Stave Prinen and Chelsy Parnard formed a partaneship- d.docx
Please Help!!! Stave Prinen and Chelsy Parnard formed a partaneship- d.docxPlease Help!!! Stave Prinen and Chelsy Parnard formed a partaneship- d.docx
Please Help!!! Stave Prinen and Chelsy Parnard formed a partaneship- d.docx
 
Please help with these questions Arterial Dissection (tear)- may be.docx
Please help with these  questions  Arterial Dissection (tear)- may be.docxPlease help with these  questions  Arterial Dissection (tear)- may be.docx
Please help with these questions Arterial Dissection (tear)- may be.docx
 
Please help with this question On June 13- the board of directors of S.docx
Please help with this question On June 13- the board of directors of S.docxPlease help with this question On June 13- the board of directors of S.docx
Please help with this question On June 13- the board of directors of S.docx
 
Please help me create a jME 3D scene uses a root node- multiple child.docx
Please help me create a jME 3D scene uses a root node- multiple child.docxPlease help me create a jME 3D scene uses a root node- multiple child.docx
Please help me create a jME 3D scene uses a root node- multiple child.docx
 
please help What is the name of the Standard Lead configuration used.docx
please help  What is the name of the Standard Lead configuration used.docxplease help  What is the name of the Standard Lead configuration used.docx
please help What is the name of the Standard Lead configuration used.docx
 
please answer both! Q2- The graph below shows one 12-hour spring tide.docx
please answer both! Q2- The graph below shows one 12-hour spring tide.docxplease answer both! Q2- The graph below shows one 12-hour spring tide.docx
please answer both! Q2- The graph below shows one 12-hour spring tide.docx
 
please explain as well 2- Let X1 and X2 be random variables (not neces.docx
please explain as well 2- Let X1 and X2 be random variables (not neces.docxplease explain as well 2- Let X1 and X2 be random variables (not neces.docx
please explain as well 2- Let X1 and X2 be random variables (not neces.docx
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
Please check the accuracy of these questions- Loss of function alleles.docx
Please check the accuracy of these questions- Loss of function alleles.docxPlease check the accuracy of these questions- Loss of function alleles.docx
Please check the accuracy of these questions- Loss of function alleles.docx
 
Please assist me with a drawing of the following- Draw a side-by-side.docx
Please assist me with a drawing of the following-  Draw a side-by-side.docxPlease assist me with a drawing of the following-  Draw a side-by-side.docx
Please assist me with a drawing of the following- Draw a side-by-side.docx
 
Please assist with 5-10- This planet is -5544 AU from the sun- 5- Comp.docx
Please assist with 5-10- This planet is -5544 AU from the sun- 5- Comp.docxPlease assist with 5-10- This planet is -5544 AU from the sun- 5- Comp.docx
Please assist with 5-10- This planet is -5544 AU from the sun- 5- Comp.docx
 
Please answer the following in 1-2 paragraphs- 1- Why are some countri.docx
Please answer the following in 1-2 paragraphs- 1- Why are some countri.docxPlease answer the following in 1-2 paragraphs- 1- Why are some countri.docx
Please answer the following in 1-2 paragraphs- 1- Why are some countri.docx
 
Please answer the blank spaces Ine Retina The retina has 2 classes o.docx
Please answer the blank spaces   Ine Retina The retina has 2 classes o.docxPlease answer the blank spaces   Ine Retina The retina has 2 classes o.docx
Please answer the blank spaces Ine Retina The retina has 2 classes o.docx
 
please answer all questions to the activites- The study of genetics an.docx
please answer all questions to the activites- The study of genetics an.docxplease answer all questions to the activites- The study of genetics an.docx
please answer all questions to the activites- The study of genetics an.docx
 
Please add in depth explanation (HARD) Suppose you repeated the Bernar.docx
Please add in depth explanation (HARD) Suppose you repeated the Bernar.docxPlease add in depth explanation (HARD) Suppose you repeated the Bernar.docx
Please add in depth explanation (HARD) Suppose you repeated the Bernar.docx
 
PICTURE INCLUDED What is the probability of the following- (a) An eve.docx
PICTURE INCLUDED  What is the probability of the following- (a) An eve.docxPICTURE INCLUDED  What is the probability of the following- (a) An eve.docx
PICTURE INCLUDED What is the probability of the following- (a) An eve.docx
 
Planned brand-company messages should- A- Create brand awareness B- Ch.docx
Planned brand-company messages should- A- Create brand awareness B- Ch.docxPlanned brand-company messages should- A- Create brand awareness B- Ch.docx
Planned brand-company messages should- A- Create brand awareness B- Ch.docx
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 

Please program both parts in Python- Please focus on part 2 and print.docx

  • 1. Please program both parts in Python. Please focus on part 2 and print output. Thank You so much Problem 3. You are given the following text. In [ ]: M text = "It was dark, like the bottom of a well. There was a pattern of skulls and bones around I the frame, for the sake of appearances; Death could not look himself in the skull in a mirror I with cherubs and roses around it. The Death of Rats climbed the frame in a scrabble of claws and looked at Death expectantly from the top. Quoth fluttered over and pecked briefly at his own reflection, on the basis that anything was worth a try. Show me, said Death, show me my thoughts. A chessboard appeared, but it was triangular, and so big that only the nearest point could be seen. Right on this point was the world - turtle, elephants, the little orbiting sun and all. It was the I Discworld, which existed only just this side of total improbability and, therefore, in border country. I In border country the border gets crossed, and sometimes things creep into the universe that have I rather more on their mind than a better life for their children and a wonderful future in the fruit picking and domestic service industries. On every other black or white triangle of the chessboard, all the way to infinity, was a small grey shape, rather like an empty hooded robe." You are also given a string that contains all symbols of English alphabet. In [3]: M alphabet = "abcdefghijklmnopqrstuvwxyz" Part 1. Write some code that generates the list unique_words, containing all and only the unique lowercase words from text. You should see the following output (the order can differl): ['a', 'infinity', 'reflection', 'with', 'like', 'big', 'briefly', 'into', 'children', 'which', 'fruit', 'picking', 'ther e', 'try', 'little', 'around', 'appearances', 'appeared', 'all', 'crossed', 'basis', 'improbability', 'their', 'discworl d', 'black', 'to', 'death', 'future', 'only', 'my', 'robe', 'things', 'for', 'it', 'existed', 'said', 'sake', 'sometime s', 'right', 'way', 'that', 'country', 'chessboard', 'quoth', 'well', 'domestic', 'skull', 'wonderful', 'hooded', 'or', 'empty', 'bottom', 'mirror', 'himself', 'rather', 'over', 'every', 'triangle', 'roses', 'border', 'orbiting', 'Was', 'fr om', 'show', 'be', 'pecked', 'bones', 'just', 'universe', 'me', 'triangular', 'gets', 'worth', 'have', 'climbed', 'servi ce', 'fluttered', 'top', 'but', 'grey', 'claws', 'at', 'rats', 'creep', 'own', 'pattern', 'point', 'white', 'than', 'dar k', 'therefore', 'frame', 'this', 'not', 'the', 'could', 'mind', 'turtle', 'scrabble', 'better', 'industries', 'looked', 'an', 'cherubs', 'life', 'anything', 'more', 'small', 'and', 'of', 'his', 'on', 'sku1ls', 'elephants', 'in', 'thoughts', 'seen', 'nearest', 'expectantly', 'other', 'side', 'shape', 'total', 'so', 'world', 'look', 'sun'] In [ ]: M Part 2. Write a program which generates the list bigrams, collect all attested bigrams in Ignore words that are shorter than 2 characters. Make sure that the list bigrams does not contain duplicates. Hint. You can use the code to extract bigrams you wrote above. Then, you need to have that code iterate over each word in the list and add a check for duplicates! In [ ]: M