Dating agency: Difference between revisions

m
no edit summary
(→‎{{header|Raku}}: Add an Raku example)
mNo edit summary
Line 127:
Elena, Julia, Perl
</pre>
 
 
=={{header|Python}}==
<lang python>"""
Jokes about courtesans aside, the selection process is by the letters of the names.
If the integer corresponding to the ASCII character of the first letter of the
name is even, the woman is considered nice. If the integers of the last letter of
the lady's name and the sailor's name are both odd or both even, the sailor should
consider the lady as lovable.
"""
 
sailors = ['Adrian', 'Caspian', 'Dune', 'Finn', 'Fisher', 'Heron', 'Kai',
'Ray', 'Sailor', 'Tao']
 
ladies = ['Ariel', 'Bertha', 'Blue', 'Cali', 'Catalina', 'Doris', 'Gale',
'Isla', 'Marina', 'Shelly']
 
def isnicegirl(s):
return ord(s[0]) % 2 == 0
 
def islovable(slady, ssailor):
return ord(slady[-1]) % 2 == ord(ssailor[-1]) % 2
 
for lady in ladies:
if isnicegirl(lady):
print("Dating service should offer a date with", lady)
for sailor in sailors:
if islovable(lady, sailor):
print(" Sailor", sailor, "should take an offer to date her.")
else:
print("Dating service should NOT offer a date with", lady)
</lang>{{out}}
<pre>
Dating service should NOT offer a date with Ariel
Dating service should offer a date with Bertha
Sailor Dune should take an offer to date her.
Sailor Kai should take an offer to date her.
Sailor Ray should take an offer to date her.
Sailor Tao should take an offer to date her.
Dating service should offer a date with Blue
Sailor Dune should take an offer to date her.
Sailor Kai should take an offer to date her.
Sailor Ray should take an offer to date her.
Sailor Tao should take an offer to date her.
Dating service should NOT offer a date with Cali
Dating service should NOT offer a date with Catalina
Dating service should offer a date with Doris
Sailor Dune should take an offer to date her.
Sailor Kai should take an offer to date her.
Sailor Ray should take an offer to date her.
Sailor Tao should take an offer to date her.
Dating service should NOT offer a date with Gale
Dating service should NOT offer a date with Isla
Dating service should NOT offer a date with Marina
Dating service should NOT offer a date with Shelly
</pre>
 
 
=={{header|Raku}}==
4,105

edits