ITECH 1400 Assignment 1: Sonnets and Doublets Analysis
VerifiedAdded on 2025/08/07
|13
|759
|287
AI Summary
Desklib provides solved assignments and past papers to help students succeed.

ITECH 1400 ASSIGNMENT 1
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Table of Contents
Introduction.................................................................................................................................................2
Part 1:..........................................................................................................................................................3
Pseudo code:............................................................................................................................................3
Demonstration of code:...........................................................................................................................4
Python code:............................................................................................................................................5
Output:....................................................................................................................................................6
Part 2:..........................................................................................................................................................7
Pseudo Code:...........................................................................................................................................7
Demonstration of code............................................................................................................................8
Python code:............................................................................................................................................9
Output...................................................................................................................................................10
Conclusion.................................................................................................................................................11
References.................................................................................................................................................12
List of figures:
Figure 1..........................................................................................................................................................4
Figure 2..........................................................................................................................................................5
Figure 3..........................................................................................................................................................5
Figure 4..........................................................................................................................................................9
Figure 5..........................................................................................................................................................9
Figure 6........................................................................................................................................................10
2
Introduction.................................................................................................................................................2
Part 1:..........................................................................................................................................................3
Pseudo code:............................................................................................................................................3
Demonstration of code:...........................................................................................................................4
Python code:............................................................................................................................................5
Output:....................................................................................................................................................6
Part 2:..........................................................................................................................................................7
Pseudo Code:...........................................................................................................................................7
Demonstration of code............................................................................................................................8
Python code:............................................................................................................................................9
Output...................................................................................................................................................10
Conclusion.................................................................................................................................................11
References.................................................................................................................................................12
List of figures:
Figure 1..........................................................................................................................................................4
Figure 2..........................................................................................................................................................5
Figure 3..........................................................................................................................................................5
Figure 4..........................................................................................................................................................9
Figure 5..........................................................................................................................................................9
Figure 6........................................................................................................................................................10
2

Introduction
In this assignment we have two parts first part is related with Sonnets part and another part is
related to doublets part. Sonnets are poem and contain lots of words, so we have task to calculate
the total number of words in this file and how many words which have one length, two lengths
etc. So we have to complete this task in this assignments.Doublets are words ladder which
started from head string and finished at tail points. So In this part calculation is related with
ladder of words.This is all about introduction part.
3
In this assignment we have two parts first part is related with Sonnets part and another part is
related to doublets part. Sonnets are poem and contain lots of words, so we have task to calculate
the total number of words in this file and how many words which have one length, two lengths
etc. So we have to complete this task in this assignments.Doublets are words ladder which
started from head string and finished at tail points. So In this part calculation is related with
ladder of words.This is all about introduction part.
3
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Part 1:
Pseudocode:
1.Read all file and split word with space and assign it any List variable
2. Create a data frame for printing output in the frame.
3. Make counter variable and count the number of occurrence of words in the list with
comparison
4. Append the words in an existing list.
5. Read a file and compare it all upper and lower alphabetic letter.
6. If it matches assign it in list and using Counter count the occurrence of word.
7. Print the list with sorted form.
8. End
4
Pseudocode:
1.Read all file and split word with space and assign it any List variable
2. Create a data frame for printing output in the frame.
3. Make counter variable and count the number of occurrence of words in the list with
comparison
4. Append the words in an existing list.
5. Read a file and compare it all upper and lower alphabetic letter.
6. If it matches assign it in list and using Counter count the occurrence of word.
7. Print the list with sorted form.
8. End
4
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Demonstration of code:
First, make data frame for print result in tabular form.Read all line with split () function. Make
counter variable for count the list variable. For calculation of 2 letters or 3 letter problem, make
Counter Class object and passed full file as an argument and print all result. Counter class return
list type data type .it’s easy to use Counter class .for printing all words of file with frequency,
Directly pass split file into Counter class and print occurrence of objects in list. So it will give
best easy output with simple code in python.
5
First, make data frame for print result in tabular form.Read all line with split () function. Make
counter variable for count the list variable. For calculation of 2 letters or 3 letter problem, make
Counter Class object and passed full file as an argument and print all result. Counter class return
list type data type .it’s easy to use Counter class .for printing all words of file with frequency,
Directly pass split file into Counter class and print occurrence of objects in list. So it will give
best easy output with simple code in python.
5

Python code:
Figure 1
Figure 2
6
Figure 1
Figure 2
6
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Output:
Screenshot of the program is displayed below:
Figure 3
7
Screenshot of the program is displayed below:
Figure 3
7
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Part 2:
In this part Doublets problem is solved easily using python.We have to create a leader of words
using starting and ending string which given in this assignment.
Pseudo Code:
1. Read the full file and assign it in file variable and passed it in Function which takes an
argument.
2. Make a Function which returns words as a list.
3. Then make a function that returns all words length.
4. Make two functions which have functionality to splits the words and stored all possible splits.
5. Make function which has functionality to store all possible next words in default dictionary.
6. Make a function which has functionality to arrange all words in list.
7. Now make the last function which has much functionality like, take starting string and find all
the words with changing index one by one and print all the words one by one at a time till the
end when target string is founded.
8. End.
8
In this part Doublets problem is solved easily using python.We have to create a leader of words
using starting and ending string which given in this assignment.
Pseudo Code:
1. Read the full file and assign it in file variable and passed it in Function which takes an
argument.
2. Make a Function which returns words as a list.
3. Then make a function that returns all words length.
4. Make two functions which have functionality to splits the words and stored all possible splits.
5. Make function which has functionality to store all possible next words in default dictionary.
6. Make a function which has functionality to arrange all words in list.
7. Now make the last function which has much functionality like, take starting string and find all
the words with changing index one by one and print all the words one by one at a time till the
end when target string is founded.
8. End.
8

Demonstration of code
First, create function that read the full file using read () and returns this words of list to list
variable and passed this in function which has functionality to return full length of words using
set list. Split the word using split function and used for loop to applied it in all words in
file .Then store all the words in default dictionary and arrange the ladder of words in doublets.
Finally make a function who return the ladders of words when passing starting words in file and
change every index of List using loop variable I and continued this process when target string is
founded.
9
First, create function that read the full file using read () and returns this words of list to list
variable and passed this in function which has functionality to return full length of words using
set list. Split the word using split function and used for loop to applied it in all words in
file .Then store all the words in default dictionary and arrange the ladder of words in doublets.
Finally make a function who return the ladders of words when passing starting words in file and
change every index of List using loop variable I and continued this process when target string is
founded.
9
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Python code:
Figure 4
Figure 5
10
Figure 4
Figure 5
10
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Output
Figure 6
11
Figure 6
11

Conclusion
Sonnets and doublets assignments have been completed with proper output .it is easy to work
with python code .sonnets problem has been finished with 3 tasks which have fully deal with
words of file. In Doublets part given string has complete with ladders of string which contain
starting string and end with target string .program of both problem is successfully run and output
of these problem has added.
12
Sonnets and doublets assignments have been completed with proper output .it is easy to work
with python code .sonnets problem has been finished with 3 tasks which have fully deal with
words of file. In Doublets part given string has complete with ladders of string which contain
starting string and end with target string .program of both problem is successfully run and output
of these problem has added.
12
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 13
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.