Department numbers: Difference between revisions
Content added Content deleted
(Added Wren) |
|||
Line 2,375: | Line 2,375: | ||
No. of options: 14 </pre> |
No. of options: 14 </pre> |
||
===Adapted from C# Example=== |
|||
<lang python> |
|||
# We start with the Police Department. |
|||
# Range is the start, stop, and step. This returns only even numbers. |
|||
for p in range(2, 7, 2): |
|||
#Next, the Sanitation Department. A simple range. |
|||
for s in range(1, 7): |
|||
# And now the Fire Department. After determining the Police and Fire |
|||
# numbers we just have to subtract those from 12 to get the FD number. |
|||
f = 12 - p -s |
|||
if s >= f: |
|||
break |
|||
elif f > 7: |
|||
continue |
|||
print("Police: ", p, " Sanitation:", s, " Fire: ", f) |
|||
print("Police: ", p, " Sanitation:", f, " Fire: ", s) |
|||
</lang> |
|||
{{Out}} |
|||
<pre> |
|||
Police: 2 Sanitation: 3 Fire: 7 |
|||
Police: 2 Sanitation: 7 Fire: 3 |
|||
Police: 2 Sanitation: 4 Fire: 6 |
|||
Police: 2 Sanitation: 6 Fire: 4 |
|||
Police: 4 Sanitation: 1 Fire: 7 |
|||
Police: 4 Sanitation: 7 Fire: 1 |
|||
Police: 4 Sanitation: 2 Fire: 6 |
|||
Police: 4 Sanitation: 6 Fire: 2 |
|||
Police: 4 Sanitation: 3 Fire: 5 |
|||
Police: 4 Sanitation: 5 Fire: 3 |
|||
Police: 6 Sanitation: 1 Fire: 5 |
|||
Police: 6 Sanitation: 5 Fire: 1 |
|||
Police: 6 Sanitation: 2 Fire: 4 |
|||
Police: 6 Sanitation: 4 Fire: 2 |
|||
</pre> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |