comp sci 101 assignment

Involves arrays and calling on files to be read 

Get Help With a similar task to - comp sci 101 assignment

Login to view and/or buy answers.. or post an answer
Additional Instructions:

1 Carleton University School of Computer Science Comp 1005- Assignment 2 Due Date: Check the schedule in the course outline Submission Guidelines: Check the assignment guidelines and recommendations in the course outline **** Assignment name: should be A2-your student number*********** Notes: It is essential that you use the built-in, default, archiving program to create this zip folder. If we cannot easily open your zip file and extract the python files from them, we cannot grade your assignment. Other file formats, such as rar, 7zip, etc., will not be accepted. Windows: Highlight (select with ctrl-click) all of your files for submission. Right-click and select “Send to” and then “Compressed (zipped) folder”. Change the name of the new folder “A1-your student number.zip”. MacOS: Highlight (select with shift-click) all of your files for submission in Finder. Right-click on one of the files and select “compress N items…” where N is the number of files you have selected. Rename the “Archive.zip” file “A1-your student number.zip”. Linux: use the zip program. After submitting your A1-your student number.zip file to cuLearn, be sure that you download it and then unzip it to be certain that what you have submitted is what you wanted to submit. This also checks that your zip file is not corrupted and can be unzipped. Coding Guidelines [ ignoring these guidelines will result in marks deductions even if your program is syntactically and logically correct]: 1- Comment your code where necessary to improve the readability of your program. 2- Use the try-except to prevent erroneous user inputs 3- Define and use functions for performing tasks within your program. 2 The assignment is composed of two questions that must be solved correctly in order to achieve a full mark. Question1 [60 marks]: Python supports the use of data files. In Python there are different modes that allow a user to create, write, append, read, and update date files. Table 1 shows the various file modes in Python. Write a Python program that creates a user interface (menu) which allows the user to choose an option from the followings menu then perform the required task accordingly. The menu should have the following options: 1. Writing text to a file: Write the 6 to 8 lines of text into a file named “assignment2.txt”. You can use special characters such as \n to separate lines. 2. Read Data from a file: reads (retrieve) the data from the file “assignment2.txt” and print it on the screen in the same format as it was input (i.e., same number of lines). Make sure Table 1: Python File modes Mode Description 'r' Opens a file for reading. 'w' Open a file for writing. If file does not exist, it creates a new file. If file exists it truncates the file. 'a' Open a file in append mode. If file does not exist, it creates a new file. '+' Open a file for reading and writing (updating) 3 the file already exist and it is not empty, otherwise warn the user that the file doesn’t exist or it is empty. 3. Search for string and calculate the number of occurrences: you should search for a certain word that you specify from the text. If the word doesn’t exist, it should report to the user “the word doesn’t exist” and asks the user to enter another word. 4. Quit the program: allows the user to quit the execution of the program. Question2 [40 marks]: Write a Python program that allows the user to print the following shape of stars according to the following algorithm 1- Move 69 spaces horizontally and print 1 star. 2- Move down, leaving a space line, and double print the number of the stars in the previous line. 3- Perform this process until you print 16 stars in the last line. 4- The left indentation (spaces to the left) of the first star in each line is (70- number of the stars in that line). For instance, the left indentation for line 3 in which it has 4 stars is (70- 4 = 66 spaces). You should use a mathematical formula that compute and print the stars in each line. Also, you should use a mathematical formula the compute the left indentation. * ** **** ******** ****************

Related Questions

Similar orders to comp sci 101 assignment
4
Views
0
Answers
Cryptography Assignment C
1. Write two programs that use some of the build-in Cryptographic APIs a. Write one C program that uses Symmetric-Key algorithm b. Write one C program that used Asymmetric-key algorithm c. Use any programming language to write your code d. Make sure t...
2
Views
0
Answers
DFA&NFA Perl language
Question about DFA and NFA Perl programming for DFA and NFA...
3
Views
0
Answers
Python Coding Homework
Its about python implementation of linguistic computer science. Due to covid its our form of exam this year and I need it till 31st of January. There will be another one of these - maybe you could calculate the price of that one on top of that....
8
Views
0
Answers
Java Labs on Array references and Array Lists
All instructions are provided on the attachments. Album lab preferably should be done ASAP, and library can wait 5 or so days. I attached the relevant powerpoint slides....