HW1
.pdf
keyboard_arrow_up
School
Northeastern University *
*We aren’t endorsed by this school
Course
5645
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
8
Uploaded by ChancellorGazelle2475
EECE 5645
Assignment 1: Text Analyzer
Follow the
Discovery Cluster Rules
:
•
Never run jobs on the gateways.
•
Do not reserve more than one node from the courses partition in the last 24 hours before a
homework deadline
•
Start working on homework assignments early.
1
EECE5645
Preparation
Follow the “Discovery Cluster Checklist” under “Programming Resources” on Canvas to copy the latest
.bashrc
file to your Discovery cluster home directory. Familiarize yourself with the
ld5645
command, also descirbed there.
Make sure that a folder on discovery named after your username exists under the directory
/scratch
. You can
confirm this by logging into the cluster and typing
ls /scratch/ | grep $USER
You should see a directory named after your username. Copy the directory
/courses/EECE5645.202410/data/HW1/Files
to the folder you just checked, renamed as
HW1
. You can do so by typing:
cp -r /courses/EECE5645.202410/data/HW1/Files /scratch/$USER/HW1
Make the contents of this directory private, by typing:
chmod -R go-rx /scratch/$USER/HW1
After you do this, your scratch
HW1
folder should contain two Python files, called
TextAnalyzer.py
and
helpers.py
.
Data
The directory called
/courses/EECE5645.202410/data/HW1/Data
contains books from the Project Guten-
berg
1
, other documents from the American National Corpus
2
, and the files
DaleChallEasyWordList.txt
and
fireandice.txt
, which will be used throughout this assignment.
Deliverables
In this assignment, you are asked to modify the provided code and use it to analyze this dataset. You must:
1. Provide a report, in
pdf
format, outlining the answers of the questions below. The report should be type-written
in a word processor of your choice (e.g., MS Word, L
A
T
E
X, etc.).
2. Provide the final files
TextAnalyzer.py
and
helpers.py
you wrote.
The report, along with your final code, should be uploaded on Canvas. Upload files separately.
DO NOT UPLOAD
.zip FILES.
1
https://www.gutenberg.org
2
http://anc.org/
c
2022, Stratis Ioannidis
2
EECE5645
Question 0:
Go to the directory that contains
TextAnalyzer.py
and run the following from the command
prompt:
python TextAnalyzer.py --help
What does this print? What portion of the code causes this to be printed? Find the documentation of the module that
offers this functionality. Use this to describe what happens at each line of code that uses a method or object defined in
this module.
Question 1:
Implement the missing functions in file
helpers.py
. In particular:
1(a)
Implement
strip_non_alpha
, as indicated in the docstring of the function. Modify the main body of
helpers.py
so that, when you run the program via
python helpers.py
the main body of the program runs unit tests (e.g., via the
assert
command) with several different inputs to confirm
that the correct output was produced. Make sure that you include tests in which either the input or the output of the
function is the empty string.
Include (i) your definition of
strip_non_alpha
, (ii) the tests you implemented in your report.
1(b)
Similarly, implement
is_inflection_of
,
same
, and
find_match
, as indicated by the corresponding
docstrings. Again, test these extensively by modifying the main body of
helpers.py
, making sure these functions
correctly handle empty strings. Include again (i)-(ii) as above (your code and unit tests) in your report.
Hint:
If you have python3 installed on your computer, you can implement and test these functions on your own
machine without connecting to the cluster.
c
2022, Stratis Ioannidis
3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Downloads/
ht 8 (File X
English
localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb
Cjupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
• Run
Code
Task 9
Write a python program that will take a string input from the user. Your task is to count the number of vowels and consonants in the string.
Using try, if the number of vowels is greater than or equal to the number of consonants, then raise a runtime error. Print 'Number of vowels greater/equal to
consonants. Please paraphrase.'.
Otherwise, print 'The sentence will work.'.
Note: a,e,i,o,u are called vowels and all the other 21 english alphabets are consonants.
=====:
Example 1:
Input:
'his age is 10'
Output:
Number of vowels greater/equal to consonants. Please paraphrase.
Example 2:
Input:
'he is 10 years old'
Output:
The sentence will work.
In [ ]: #to do
Task…
arrow_forward
Downloads/
ht 8 (File X
English
localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb
Cjupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
> Run
Code
Task 6
Given a list named my_list.
my_list = [10, 20, 30, 40, 60, 100, 2, 5]
Write a python program that takes the position as an input from the user and prints the element of that position from the list.
If the user's input position is not in the range, return an exception stating "Index out of range".
If the user's input position is not an Ingeter number, return an exception stating "For position, please enter an Integer value".
Make sure your program always prints "Program ended" at the end, no matter what happens.
Hint: Use finally block
Example 1:
Input:
1
Output:
20
Program ended
=======:
Example 2:
Input:
10
Output:
Index out of range.
8:28 PM
* 4)
1/4/2022
arrow_forward
Downloads/
ht 8 (File X
English
localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb
C jupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
+
• Run
с
Code
Task 11
Imagine Salman Khan is going to the sets of a new movie. He decides to cycle everyday on his way to the sets. For that he uses a distance calculator which
finds the distance based on the present day's date, which is asked as an input from the user. You should first take the day and then the month as your inputs.
The inputs should be stored in variables named day and month .The distance calculator uses the following formula to calculate a number which dictates the
number of kilometers he must cycle on his way to work.
Distance = lif day<10, 5+(day*2)/month
|else, 3+(day/month)
Exceptions to handle:
-Check for 0 division error exception in the formula
-Type…
arrow_forward
Downloads/
CSE110 Lab Assignment 8 (File X
English
O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb
jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Not Trusted
Python 3 O
+
> Run
Code
In [ ]: #to do
Task 3
Write a python program that allows you to erase multiple spaces in a text file. Then re-write the sentence without extra spaces in a another text file.
========
=========
Input:
love
Python
Programming
Output:
I love Python Programming.
Hints:
You can use split function to separate the words into a list.
In [ ]: #to do
Task 4
L OneDrive
Write a Python program to count the number of lines in a text file. Then, finally print the total number of lines.
Screenshot saved
The screenshot was added to your
OneDrive.
Input:
Hello
10:43 AM
* 4)
1/4/2022
arrow_forward
Downloads/
CSE110 Lab Assignment 8 (File X
English
O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb
jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Not Trusted
Python 3 O
+
• Run
с
Code
Task 1
Write a python program that reads the first n lines of a text file.
Suppose you have a file with all these strings in a file.
I love Python Programming.
It is very easy to understand the code.
It can code very hard problems easily in python code.
Python programming is the best programming language.
=======
==D=D=D=======
Input :
2
Output :
I love Python Programming.
It is very easy to understand the code.
Hint(1):
Use counter to control line number.
Hint(2):
Use function readlines() to store in a list and then use loop
OR you can use readline() in a loop.
Hint(3):
You might need to use strip() function
10:43 AM
* 4)
1/4/2022
arrow_forward
Downloads/
CSE110 Lab Assignment 8 (File X
English
O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb
jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Not Trusted
Python 3 O
• Run 1
Code
You might need to use strip() function
In [ ]: #to do
Task 2
Write a python program to find the longest word in a file. Then print the word.
Input: [in a file]
I love Python Programming
It is very easy to understand the code
It can code very hard problems easily in python code
Python programming is the best programming language
Output:
Programming
Hint(1):
You can use split function to separate the words into a list.
Hint(2):
Use function readlines()
In [ ]: #to do
L OneDrive
Screenshot saved
The screenshot was added to your
Task 3
OneDrive.
Write a python program that allows you to erase multiple spaces in a text file. Then re-write the sentence without extra spaces in a…
arrow_forward
Kubernetes cluster question
arrow_forward
Exercise 2-2 Enhance the Future Value application In this exercise, you’ll enhance the Future Value application by applying some of the skills that you’ve just learned.
Test the Future Value application 1. Make sure the Apache server is running. Then, start your browser and run the application in this directory: xampp\htdocs\ex_starts\ch02_ex2 To do that, you can use the index of exercise starts that you bookmarked in exercise 1-2 or you can use this URL: http://localhost/ex_starts/ch02_ex2/
2. Enter valid numbers in all three text boxes. For the first test run, keep these values simple like 100 for investment amount, 5 for yearly interest rate, and 10 for number of years. Then, click the Calculate button to display the results.
3. Click the Back button to return to the first page, enter invalid values in the first two text boxes, and click the Calculate button. Then, respond to the error message that’s displayed by entering valid data for the investment amount, re-entering…
arrow_forward
Linux LDAP server question
Write exact step by step commands
Configure also
I also need commands
arrow_forward
Create a student api.
The student resource contains the below information
Id, first name, last name, email
Generate a project file with the correct dependencies
Configure the application properties file for connecting to an H2 or mysql database
Create a model
Create a repository
Create the controller and implement the Standard CRUD HTTP methods
Create an endpoint that returns a list of students
Create an endpoint that returns back a single student by id
Create an endpoint the adds a student to the database
Create an endpoint that updates a student
Create an endpoint that deletes a student
arrow_forward
Event viewer logs sort server events. Pick two.
arrow_forward
Please due in C++
arrow_forward
Guido van Rossum
guido@python.org
+31 0474 33 88 26
Eric Idle
eric@ericidle.com
+44 20 7946 0958
The required info from instructor.
arrow_forward
Downloads/
CSE110 Lab Assignment 7 (Sortin x
O localhost:8889/notebooks/Downloads/CSE110%20Lab%20Assignment%207%20(Sorting%20and%20Searching).ipynb
jupyter CSE110 Lab Assignment 7 (Sorting and Searching) Last Checkpoint: 2 hours ago (autosaved)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
+
• Run
Markdown
Task 5
Suppose a list contains marks earned in the courses CSE110, PHY111, and MAT110 of each student consecutively in a nested list form. Your task is to take a
course name as input from the user and sort the list based on the marks obtained in that course in order to finally print the names of the students in
descending order of marks obtained i.e. from the student who earned the highest marks to the student who earned the lowest.
For example, the list may look like
Ist = [["Alan", 95, 87, 91], ["Turing", 92, 90, 83], ["Elon", 87, 92, 80], ["Musk", 85, 94, 90] ]
where for each nested list, 1st index holds the name of the student, 2nd index is total marks…
arrow_forward
Downloads/
CSE110 Lab Assignment 7 (Sortin x
O localhost:8890/notebooks/Downloads/CSE110%20Lab%20Assignment%207%20(Sorting%20and%20Searching).ipynb
jupyter CSE110 Lab Assignment 7 (Sorting and Searching) Last Checkpoint: 11 minutes ago (autosaved)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
> Run
Code
Musk
Elon
Turing
Alan
Task 6
Suppose you have a list named my_list as given below. Your task is to sort the list in ascending order and print the count of numbers that have changed their
positions in the process of sorting.
my_list = [4, 2, 3, 1, 6, 5]
Sorted list would be [1, 2, 3, 4, 5, 6] where 4 numbers (4, 1, 6 and 5) have changed their positions. Therefore our sample output here would be 4. Please
check if your code is working correctly by changing the above list and using the knowledge given here to verify whether your code gives correct output for all
different lists.
Sample Output for the above list
4
In [ ]:
Task 7
Write a python program that takes…
arrow_forward
Console if the contacts file is not found
Contact Manager
Could not find contacts file!
Starting new contacts file...
COMMAND MENU
list - Display all contacts
view - View a contact
add - Add a contact
del - Delete a contact
exit Exit program
Command: list
There are no contacts in the list.
Command: add
Name: Mike Murach
Email: mike@murach.com
Phone: 559-123-4567
Mike Murach was added.
Command: list
1. Mike Murach
Command: view
Number: 2
Invalid contact number.
Command: view
Number: *
Invalid integer.
Command: view
Number: 1
Name: Mike Murach
Email: mike@murach.com
Phone: 559-123-4567
Command: exit
Bye!
Specifications
•
When the program starts, it should read the contacts from a CSV file named contacts.csv. Your
instructor should provide this file if you don't already have it.
•
If the program can't find the CSV file, it should display an appropriate message and create a new
CSV file that doesn't contain any contact data.
•
For the view and del commands, display an appropriate error…
arrow_forward
https://drive.google.com/drive/folders/1Ghu-oV9atvNe3Dgrrm4C901wcdI8xUPD?usp=sharing file needed
Process: The user (client) requests data from the (server) database. The database sends back the data to the user. At acquisition of the data an XYPlot is drawn.
DataFile: USAStates2020.csv
User Layer:The user selects a country, and passes the country name to the Business Layer. Use TKinter to produce a UI for the user to select a country. Send the selected country to the Business Layer.
Business Layer:Receives the information from the User Layer and constructs a SQL query to send to the Data Layer. The query extracts the yearly data (1970,2020) for the requested country. The data may be queried either country year-by-year or in one query for year range. After receiving the JSON string back from the Data Layer, send the data to the Graphic Layer for plotting.
Data Layer:Construct a SQL Database based on the data from the DataFile. Processes the queries from the Business Layer.…
arrow_forward
lab 2 : data sockets
https://drive.google.com/drive/folders/1Ghu-oV9atvNe3Dgrrm4C901wcdI8xUPD?usp=share_link the files necessary
arrow_forward
For the virtual machine, do the following:
locate and download virtual box/VMware player/Parallels VMM from the appropriate website.
pay attention to the MD5 and SHA1 hash values.
download the software
before installing the software, Hash the file and see if the value you get matches the value provided by the download website.
Install the software only if the hashes match.
locate and download Unbuntu/Kali Linux (most recent version)
view the MD5 and SHA1 values
hash the downloaded file to compare the hash values
install the file only of the hashes match
after installation, take a screen shot of the computer name in Ubuntu/Kali and the date.
Submit the screen shot as proof of installation
google MD5 and SHA1 hash creation (should be free and part of your O.S.
arrow_forward
Question 9
A use case description is generic with few details. For this reason it does not contain numbered steps and alternatives to those
steps. That is the kind of information contained in a user story.
True
False
Question 10
Which git command would you use to update a remote repository with the current changes made in a local repository?
pull
clone
commit
add
None of the above
Question 11
The UML symbol to show composition/aggregation is a diamond. The diamond should be attached to the
containing class
contained class
fat headed arrow
center of a dashed line
arrow_forward
Hands-On Project 9-4
In this project you will work with cookies that stores the fastest time to complete a sliding block puzzle.
Much of the code for the puzzle has already been written. Your task is to write the code that records
the user's best time and stores it within a persistent cookie with a 90-day lifetime.
To complete this task you will have to load your project onto a web server placed on a remote site or
installed on your own computer. If you need to install your own server, you can download free server
software like XAMPP from the web or you can use software supplied by your instructor.
NOTE: If you are unable to get access to a server, you can complete this project using local web
storage by modifying the steps to store data in the localStorage object rather than in a cookie.
Hands-on Project 9-4
Sliding Eight Puzzle
Arrange the blocks in numeric order from 1 to 8. To move a block into the blank space, click a block
adjacent to the space. Click the Start button to scramble…
arrow_forward
Given the three fields each node of the linked list, which of the following best describes end index?
Group of answer choices
the end index of the partition
None of these
the starting index of the partition
shows whether the partition is a hole or a process
arrow_forward
response page checks username and
password against arrays of valid usernames
and passwords (normally this is done
against a database - we'll change it later)
If valid - saves username to cookie, and sets
session variable LoggedIn to TRUE. If not,
sets the session variable to FALSE.
Displays link to "content page" (the page
you're protecting).
Created with Mi Notes
arrow_forward
By default, session state objects are tracked by the use of
cookies or query strings
query strings
cookies
none of the above
arrow_forward
To keep the existing path environment variables when we add new path(s), we will need to include this as part of the command.
Group of answer choices
%oldpath%
&path&
%path%
(path)
arrow_forward
Views can save state across configuration changes such as device rotations if you
Any of these
assign it a resource id
Subclass the View from class PreserveState
O call the preserveStateMethod() on View
arrow_forward
uestion :
Torrent is a file/data distribution system used for sharing data over theinternet. You are required toexplain the working of torrents with help of a figure and the role of a database in managing torrents.
arrow_forward
Create a node server with the following requirements:
Use the dotenv package to manage your development environment variables.
PORT should be 3000
HOST should be localhost
Endpoints
/dotted
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: word1 and word2.
The endpoint will take the two words and create a string that is the two words separated by enough “.” characters to make the length of the string 30.
For example if word1 is “turtle” and word2 is “153” the output should be: turtle.....................153
The response body should be the string wrapped in a <pre> tag.
/fizzBuzz
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: start and end.
The endpoint will iterate from start to end and for each number it will:
Show “Fizz” if the number is divisible by 3.
Show “Buzz” if the number is…
arrow_forward
Create a node server with the following requirements:
Use the dotenv package to manage your development environment variables.
PORT should be 3000
HOST should be localhost
Endpoints
/dotted
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: word1 and word2.
The endpoint will take the two words and create a string that is the two words separated by enough “.” characters to make the length of the string 30.
For example if word1 is “turtle” and word2 is “153” the output should be: turtle.....................153
The response body should be the string wrapped in a <pre> tag.
/fizzBuzz
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: start and end.
The endpoint will iterate from start to end and for each number it will:
Show “Fizz” if the number is divisible by 3.
Show “Buzz” if the number is…
arrow_forward
Create a node server with the following requirements:
Use the dotenv package to manage your development environment variables.
PORT should be 3000
HOST should be localhost
Endpoints
/dotted
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: word1 and word2.
The endpoint will take the two words and create a string that is the two words separated by enough “.” characters to make the length of the string 30.
For example if word1 is “turtle” and word2 is “153” the output should be: turtle.....................153
The response body should be the string wrapped in a <pre> tag.
/fizzBuzz
Only GET requests are allowed.
This endpoint will respond with the HTML content type.
This endpoint will take two required query parameters: start and end.
The endpoint will iterate from start to end and for each number it will:
Show “Fizz” if the number is divisible by 3.
Show “Buzz” if the number is…
arrow_forward
For this project you will have to build a web application for managing a support ticketing system (STS). The application must be implemented with PHP. You can use a relational database like MySQL. - Non-logged-in users should see a “Register” menu link on all pages, which leads them to the registration page - The registration process requires the user’s email, password, name and team - The email should be a valid email address and not exist in the system (two registered users cannot have the same email) - Passwords should be at least 6 characters long and should contain both letters and numbers - The team should be one of the following values: Development, Support, Sales - Proper validation should be performed by the system, and detailed error messages displayed - Non-logged-in users should see a “Login” menu link on all pages, leading to the login page - login page asks for user email and password.
arrow_forward
You have a storage account that contains multiple containers, blobs, queues, and tables.You need to create a key to allow an application to access only data from a given table in the storage account.Which authentication method should you use for the application?
1
SAS
shared
service SAS
user delegation SAS
arrow_forward
Procedure:
1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark)
2. Using NetBeans, create a Java project named StudentList. Set the project location to your own
folder.
3. Import Scanner, Map, and HashMap from the java.util package.
4. Create an empty hash map named students.
5. The output shall:
5.1. Ask three (3) of your classmates to enter their student number (key) and first name (value).
5.2. Display the keys and values of the map.
5.3. Delete the mapping of the third entry.
5.4. Enter your student number and first name. This would be the new third entry.
5.5. Display the entries in separate lines.
6. Create a Python script that meets the same specifications. Feel free to use lists to store input.
7. Save the script as student_list.py to your folder.
Sample output:
Enter student number 1: 2018-0004
Enter first name 1: Mark
Enter student number 2: 2018-0017
Enter first name 2: Nika
Enter student number 3: 2018-0134
Enter first name 3: Mairo
Student…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L
Related Questions
- Downloads/ ht 8 (File X English localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb Cjupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Trusted Python 3 O • Run Code Task 9 Write a python program that will take a string input from the user. Your task is to count the number of vowels and consonants in the string. Using try, if the number of vowels is greater than or equal to the number of consonants, then raise a runtime error. Print 'Number of vowels greater/equal to consonants. Please paraphrase.'. Otherwise, print 'The sentence will work.'. Note: a,e,i,o,u are called vowels and all the other 21 english alphabets are consonants. =====: Example 1: Input: 'his age is 10' Output: Number of vowels greater/equal to consonants. Please paraphrase. Example 2: Input: 'he is 10 years old' Output: The sentence will work. In [ ]: #to do Task…arrow_forwardDownloads/ ht 8 (File X English localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb Cjupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Trusted Python 3 O > Run Code Task 6 Given a list named my_list. my_list = [10, 20, 30, 40, 60, 100, 2, 5] Write a python program that takes the position as an input from the user and prints the element of that position from the list. If the user's input position is not in the range, return an exception stating "Index out of range". If the user's input position is not an Ingeter number, return an exception stating "For position, please enter an Integer value". Make sure your program always prints "Program ended" at the end, no matter what happens. Hint: Use finally block Example 1: Input: 1 Output: 20 Program ended =======: Example 2: Input: 10 Output: Index out of range. 8:28 PM * 4) 1/4/2022arrow_forwardDownloads/ ht 8 (File X English localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_0%20%26%20Exception).ipynb C jupyter CSE110 Lab Assignment 8 (File I_O & Exception) Last Checkpoint: 6 hours ago (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Trusted Python 3 O + • Run с Code Task 11 Imagine Salman Khan is going to the sets of a new movie. He decides to cycle everyday on his way to the sets. For that he uses a distance calculator which finds the distance based on the present day's date, which is asked as an input from the user. You should first take the day and then the month as your inputs. The inputs should be stored in variables named day and month .The distance calculator uses the following formula to calculate a number which dictates the number of kilometers he must cycle on his way to work. Distance = lif day<10, 5+(day*2)/month |else, 3+(day/month) Exceptions to handle: -Check for 0 division error exception in the formula -Type…arrow_forward
- Downloads/ CSE110 Lab Assignment 8 (File X English O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Not Trusted Python 3 O + > Run Code In [ ]: #to do Task 3 Write a python program that allows you to erase multiple spaces in a text file. Then re-write the sentence without extra spaces in a another text file. ======== ========= Input: love Python Programming Output: I love Python Programming. Hints: You can use split function to separate the words into a list. In [ ]: #to do Task 4 L OneDrive Write a Python program to count the number of lines in a text file. Then, finally print the total number of lines. Screenshot saved The screenshot was added to your OneDrive. Input: Hello 10:43 AM * 4) 1/4/2022arrow_forwardDownloads/ CSE110 Lab Assignment 8 (File X English O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Not Trusted Python 3 O + • Run с Code Task 1 Write a python program that reads the first n lines of a text file. Suppose you have a file with all these strings in a file. I love Python Programming. It is very easy to understand the code. It can code very hard problems easily in python code. Python programming is the best programming language. ======= ==D=D=D======= Input : 2 Output : I love Python Programming. It is very easy to understand the code. Hint(1): Use counter to control line number. Hint(2): Use function readlines() to store in a list and then use loop OR you can use readline() in a loop. Hint(3): You might need to use strip() function 10:43 AM * 4) 1/4/2022arrow_forwardDownloads/ CSE110 Lab Assignment 8 (File X English O localhost:8888/notebooks/Downloads/CSE110%20Lab%20Assignment%208%20(File%201_O%20%26%20Exception).ipynb jupyter CSE110 Lab Assignment 8 (File l_O & Exception) (unsaved changes) Logout File Edit View Insert Cell Kernel Widgets Help Not Trusted Python 3 O • Run 1 Code You might need to use strip() function In [ ]: #to do Task 2 Write a python program to find the longest word in a file. Then print the word. Input: [in a file] I love Python Programming It is very easy to understand the code It can code very hard problems easily in python code Python programming is the best programming language Output: Programming Hint(1): You can use split function to separate the words into a list. Hint(2): Use function readlines() In [ ]: #to do L OneDrive Screenshot saved The screenshot was added to your Task 3 OneDrive. Write a python program that allows you to erase multiple spaces in a text file. Then re-write the sentence without extra spaces in a…arrow_forward
- Kubernetes cluster questionarrow_forwardExercise 2-2 Enhance the Future Value application In this exercise, you’ll enhance the Future Value application by applying some of the skills that you’ve just learned. Test the Future Value application 1. Make sure the Apache server is running. Then, start your browser and run the application in this directory: xampp\htdocs\ex_starts\ch02_ex2 To do that, you can use the index of exercise starts that you bookmarked in exercise 1-2 or you can use this URL: http://localhost/ex_starts/ch02_ex2/ 2. Enter valid numbers in all three text boxes. For the first test run, keep these values simple like 100 for investment amount, 5 for yearly interest rate, and 10 for number of years. Then, click the Calculate button to display the results. 3. Click the Back button to return to the first page, enter invalid values in the first two text boxes, and click the Calculate button. Then, respond to the error message that’s displayed by entering valid data for the investment amount, re-entering…arrow_forwardLinux LDAP server question Write exact step by step commands Configure also I also need commandsarrow_forward
- Create a student api. The student resource contains the below information Id, first name, last name, email Generate a project file with the correct dependencies Configure the application properties file for connecting to an H2 or mysql database Create a model Create a repository Create the controller and implement the Standard CRUD HTTP methods Create an endpoint that returns a list of students Create an endpoint that returns back a single student by id Create an endpoint the adds a student to the database Create an endpoint that updates a student Create an endpoint that deletes a studentarrow_forwardEvent viewer logs sort server events. Pick two.arrow_forwardPlease due in C++arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.Computer ScienceISBN:9781337569798Author:ECKERTPublisher:CENGAGE L
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L