Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

50%
+0 −0
Challenges Golf golf challenge

Python 3, 108 bytes lambda p,s:s<2and"Hole in one"or"Par:Bogey:Double bogey:Triple bogey:Albatross:Eagle:Birdie".split(':')[s-p] Try it online! Very similar to my other solution, but hand...

posted 2y ago by dino‭

Answer
#1: Initial revision by user avatar dino‭ · 2022-01-07T20:54:13Z (over 2 years ago)
# [Python 3], 108 bytes

<!-- language-all: lang-python -->

    lambda p,s:s<2and"Hole in one"or"Par:Bogey:Double bogey:Triple bogey:Albatross:Eagle:Birdie".split(':')[s-p]

[Try it online!][TIO-ky4vigcm]

Very similar to my other solution, but handles the "Hole in one" case independently and uses wrap-around indexing for the other cases

[Python 3]: https://docs.python.org/3/
[TIO-ky4vigcm]: https://tio.run/##TY@xasMwEIZ3P8WhxTYoJY6TEtRmSEigY4durge5ll2BIgndZQjBz@7agRrd9P3/fcOdv9Ovs@XYHb5HI69NK8FzFPi@kbZlH84o0BacVcwF9imDOLle3cXZ3Zpp1TzDV9B@CUfTSAoOUVxkb5Q46dBqxV7QG01ZKtK8wpWvR1JIPxIVwgGqBKbJthy2OV@4jHgX8eafdxGXHIrIKaL@NfL3kTP3dZJ0LgDNTy4Xiafig7aUdexBw3Tio8uoWtccqCrqfGD52/gH "Python 3 – Try It Online"