Question: In this second assignment, you will write the function isAStateLegal ( ) . Besides the correctness, your program will also be evaluated based on readability

In this second "assignment," you will write the function isAStateLegal ().
Besides the correctness, your program will also be evaluated based on readability (e.g., comments, variable names, structures, etc) and design of functions (for (3) only). This question carries 20 points.
Important reminders and restrictions Points will be deducted if violating these restrictions.
1. This is an individual project.
2. You are expected to write all the code yourself.
3. No import statements allowed.
4. You have to use all the functions given.
5. You cannot change the doctrings of all functions and their names.
6. You cannot change the code in explore_paths () and find_all_shortest_paths ().
7. You cannot use any built-in functions except print () and type conversion functions.
8. You cannot use list comprehensions.
Use the template below and name the file midterm_legality.py.
```
"""CS 108- Midterm project - part 2
Describe the module here. Fix the lab number above and the name/date below.
@author: Rocky Chang
@date: Fall, 2024
"""
def isAStateLegal(state):
"""Determine whether a state is legal
Parameters
-----------
state : string
A state
Returns
-------
Boolean
True if the state is legal; False, otherwise
"""
# testing the function
print("Test 2: Testing the legality of states")
print("EEEE is legal:", isAStateLegal('EEEE'))
print("WEEE is legal:", isAStateLegal('WEEE'))
print("WEWE is legal:", isAStateLegal('WEWE'))
print("WEEW is legal:", isAStateLegal('WEEE'))
```
The expected results are:
```
Test 2: Testing the legality of states
EEEE is legal: True
WEEE is legal: False
WEWE is legal: True
WEEW is legal: False
```
In this second "assignment," you will write the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!