Lab 04
Lab 04
Lab 04
Lab Objectives: Strings, Files, Modules
Notes:
● You should only use functionality covered in CS115 in your solution.
● Your solution for this lab should not use the str.split() method, lists, tuples, dictionaries.
● Include a docstring for your functions. A template for function docstrings is below:
"""Summary or Description of the Function
Parameters:
argument1 (type): Description of arg1
Returns:
type: return value
"""
Hint1: To check the rule, store all of the English alphabetic letters in a string variable and use their
index to access them.
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
Hint2: You can replace ‘\n’ character at the end of the line with a space character to process that
word also.
b. containsLetter(s,c): takes a string s, and a character c as parameters and returns true if the
string contains the given character and false if not.
2. Write a script, Lab04_yourname_application.py that
• Reads lines from a text file (specialText.txt), and checks whether each line conforms to the rule
using the ruleChecker()function. The program should output a statement to an output file,
out.txt, indicating whether each line conforms to the rule or not (see sample file output below).