Information Technology > QUESTIONS & ANSWERS > Create your own code which performs the task and run it. Display the code and the result on your scr (All)
Question Answered step-by-step Create your own code which performs the task and run it. Display... Create your own code which performs the task and run it. Display the code and the result on your s ... creen. Task 1: Objectives improving the student's skills in operating with strings; using built-in Python string methods. Scenario Study the buit-in Python function split() works and prove that you understand it. Your task is to create your own function, which behaves almost exactly like the original split() method, i.e.: it should accept exactly one string argument; it should return a list of words created from the string, divided in the places where the string contains whitespaces; if the string is empty, the function should return an empty list; its name should be mysplit() Test print(mysplit("To be or not to be, that is the question")) print(mysplit("To be or not to be,that is the question")) print(mysplit(" ")) print(mysplit(" abc ")) print(mysplit("")) Expected output ['To', 'be', 'or', 'not', 'to', 'be,', 'that', 'is', 'the', 'question'] ['To', 'be', 'or', 'not', 'to', 'be,that', 'is', 'the', 'question'] [] ['abc'] [] Task 2: Objectives improving the student's skills in operating with strings; using the find() method for searching strings. Scenario Let's play a game. We will give you two strings: one being a word (e.g., "dog") and the second being a combination of any characters. Your task is to create a program which answers the following question: are the characters comprising the first string hidden inside the second string? For example: if the second string is given as "vcxzxduybfdsobywuefgas", the answer is yes; if the second string is "vcxzxdcybfdstbywuefsas", the answer is no (as there are neither the letters "d", "o", or "g", in this order) Hints: You should use the two-argument variants of the pos() functions inside your code; don't worry about case sensitivity. Test your code using the data we've provided. Test data Sample input: donor Nabucodonosor Sample output: Yes Sample input: donut Nabucodonosor Sample output: No Task 3 Objectives improving the student's skills in operating with strings; creating files and folders; writing to and reading from files. Scenario You are tasked to create your own Python module named after you to help create score cards to students in a class. The following seven subject should show on each student's score card: Algebra, English, Statistics, History, Biology, Physics, and Computing. 1. Our program should first ask for a student's name, then her/his scores for the seven subjects in the order shown above. 2. This process will be repeated until all the students' scores are entered. Note that there are 13 students and their names are the AB, CD, EF, ..., WX, and YZ. (hint: use Python ASCII/UTF-8 functions chr and ord to generate the names) 3. For each student, (e.g., AB), create your own score card file named (e.g., ab.txt) and input her scores in two columns, one for the subjects and one for the scores. The subject and the score are on the same line. An empty line separates two subjects. A total score, and an average score should also be printed at the bottom. All the files should be stored in a folder created automatically in your working directory and named Scores. 4. Your module should be importable into and usable from the Python shell. After all the inputs are done, the program should ask the user to input a student's name. Then the program should print that student's score card should be able to print the score card on [Show More]
Last updated: 3 years ago
Preview 1 out of 6 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Jul 05, 2021
Number of pages
6
Written in
All
This document has been written for:
Uploaded
Jul 05, 2021
Downloads
0
Views
57
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·