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 eg comments, variable names, structures, etc and design of functions for only This question carries points.
Important reminders and restrictions Points will be deducted if violating these restrictions.
This is an individual project.
You are expected to write all the code yourself.
No import statements allowed.
You have to use all the functions given.
You cannot change the doctrings of all functions and their names.
You cannot change the code in explorepaths and findallshortestpaths
You cannot use any builtin functions except print and type conversion functions.
You cannot use list comprehensions.
Use the template below and name the file midtermlegality.py
CS Midterm project part
Describe the module here. Fix the lab number above and the namedate below.
@author: Rocky Chang
@date: Fall,
def isAStateLegalstate:
Determine whether a state is legal
Parameters
state : string
A state
Returns
Boolean
True if the state is legal; False, otherwise
# testing the function
printTest : Testing the legality of states"
printEEEE is legal:", isAStateLegalEEEE
printWEEE is legal:", isAStateLegalWEEE
printWEWE is legal:", isAStateLegalWEWE
printWEEW is legal:", isAStateLegalWEEE
The expected results are:
Test : Testing the legality of states
EEEE is legal: True
WEEE is legal: False
WEWE is legal: True
WEEW is legal: False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
