Dinesman's multiple-dwelling problem: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Add second solution method using Amb.)
Line 366:
 
=={{header|Python}}==
===ParsingBy parsing the problem statement===
This example parses the statement of the problem as given and allows some variability such as the number of people, floors and constraints can be varied although the type of constraints allowed and the sentence structure is limited
 
====;Setup====
 
Parsing is done with the aid of the multi-line regular expression at the head of the program.
 
Line 505 ⟶ 506:
handler[groupname](txt)</lang>
 
====;Problem statement====
 
This is not much more than calling a function on the text of the problem!
<lang python>if __name__ == '__main__':
Line 530 ⟶ 532:
adjacent to Cooper's. Where does everyone live?""")</lang>
 
====;Output====
 
This shows the output from the original problem and then for another, slightly different problem to cover some of the variability asked for in the task.
<pre>Floors are numbered from 1 to 5 inclusive.