create dictionary with all the data, take user input, and use str.split to get a list of all the ...

Get Started. It's Free
or sign up with your email address
create dictionary with all the data, take user input, and use str.split to get a list of all the words in user input by Mind Map: create dictionary with all the data, take user input, and use str.split to get a list of all the words in user input

1. if the first word is "freebeds"

1.1. get hospital from second word

1.1.1. if hospital is invalid

1.1.1.1. say "invalid hospital"

1.1.2. otherwise

1.1.2.1. iterate through the hospital data

1.1.2.1.1. if bed is vacant, add bed to output

2. if the first word is "book"

2.1. get name, phone number, age, password, hospital, and bed number from the user input

2.1.1. if phone number is invalid

2.1.1.1. say "invalid phone number"

2.1.2. if age is not a number

2.1.2.1. say "invalid age"

2.1.3. if hospital is invalid

2.1.3.1. say "invalid hospital"

2.1.4. if bed number is invald

2.1.4.1. say "invalid bed"

2.1.5. if bed is already booked

2.1.5.1. say "bed is already booked"

2.1.6. otherwise

2.1.6.1. add the booking data to our dictionary

3. if the first word is "discharge"

3.1. get password, bed number, and hospital from user input

3.1.1. if hospital is invalid

3.1.1.1. say "invalid hospital"

3.1.2. if bed number is invalid

3.1.2.1. say "invalid bed number"

3.1.3. if bed is vacant

3.1.3.1. say "bed already vacant"

3.1.4. if password doesn't match

3.1.4.1. say "invalid password"

3.1.5. otherwise

3.1.5.1. set the bed status to vacant

4. if the first word is "bookinginfo"

4.1. if a name is given

4.1.1. iterate through our data and try to match the name given

4.1.1.1. if no matches found

4.1.1.1.1. say "no booking with that name found"

4.1.1.2. if found

4.1.1.2.1. say the booking name, hospital, and bed number

4.2. if a name is not given

4.2.1. iterate through our data

4.2.1.1. if bed is not vacant

4.2.1.1.1. add bed number and name to output

5. if user input is "ok"

5.1. exit the program