Activity for dino
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #287444 | Initial revision | — | almost 2 years ago |
Answer | — |
A: Encode with ROT13.5 [Python 3], 145 bytes lambda s:[dict({chr(i+c):chr((i+13)%26+c)for i in range(26)for c in(65,97)},{chr(i+48):chr((i+5)%10+48)for i in range(10)}).get(c,c)for c in s] Try it online! Generates and concatonates 2 dicts: `{chr(i+c):chr((i+13)%26+c)for i in range(26)for c in(65,97)... (more) |
— | almost 2 years ago |
Edit | Post #287442 | Initial revision | — | almost 2 years ago |
Answer | — |
A: Lowercase, but not just the letters [Python 3], 35 bytes lambda x:[chr(ord(i)|32)for i in x] Try it online! Performs a list comprehension on the input string; for each character it: transforms it into the ASCII character code integer representation using `ord()` performs a `binary or` with `32` (or `0b100000`... (more) |
— | almost 2 years ago |
Edit | Post #286801 |
Post edited: |
— | almost 2 years ago |
Edit | Post #286801 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287352 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287352 | Initial revision | — | almost 2 years ago |
Answer | — |
A: Sort letters by height [Python 3], 43 bytes lambda x:sorted(x,key='tibdfghklpqyj'.find) Try it online! Sorts based on index in a sorted string. Inputs as a string and outputs as a list. -14 bytes by replacing `.index()` with `.find()` (more) |
— | almost 2 years ago |
Edit | Post #286801 |
Post edited: |
— | about 2 years ago |
Edit | Post #286801 |
Post edited: |
— | about 2 years ago |
Edit | Post #286801 |
Post edited: |
— | over 2 years ago |
Edit | Post #286801 |
Post edited: |
— | over 2 years ago |
Edit | Post #286801 | Initial revision | — | over 2 years ago |
Answer | — |
A: Cumulative Counts [Python 3.8 (pre-release)], 69 bytes def f(x,y={},z=[]): for i in x:y[i]=y.get(i,0)+1;z+=[y[i]] return z Try it online! Bonus: theoretical answer if python allowed named assignment with subscript (54 bytes) ```python lambda x,y={}:[y[i]:=y[i]+1if i in y else 1for ... (more) |
— | over 2 years ago |
Edit | Post #286431 | Initial revision | — | over 2 years ago |
Answer | — |
A: Word Count Tool [Python 3.8], 73 bytes lambda x:[len(x.split()),len(x.replace('\n','')),len(''.join(x.split()))] Try it online! (more) |
— | over 2 years ago |
Edit | Post #286073 | Initial revision | — | over 2 years ago |
Answer | — |
A: Solve Goldbach's Conjecture [Python 3.8], 112 bytes def f(x):y=[i for i in range(2,x)if not[j for j in range(2,i)if i%j<1]];return(q,x-q)for q in y if x-q in y Try it online! (more) |
— | over 2 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285508 |
My hope with this solution was that I could extract the duplicate " bogey" to make it shorter, but I couldn't get it shorter than 110 bytes with the bogey extracted: https://tio.run/##TY@xjsIwDED3foWVKYFwulJAJ@56EhVIjAxspUMKKRep10SxGRDi20uKBIoXP1vPlu2u9Ge7rG/yQ9@q//qkwElcsq1tNZgObKfZiOPPVFjPdspDYc/6C... (more) |
— | almost 3 years ago |
Edit | Post #285508 | Initial revision | — | almost 3 years ago |
Answer | — |
A: 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 handles the "Hole in one" case independently and uses wrap-around indexing for the other cases ... (more) |
— | almost 3 years ago |
Edit | Post #285503 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Golf golf challenge [Python 3], 108 bytes lambda p,s:"Hole in one:Albatross:Eagle:Birdie:Par:Bogey:Double bogey:Triple bogey".split(':')[s-1and s-p+4] Try it online! (more) |
— | almost 3 years ago |
Comment | Post #285479 |
Very nice, thank you! (more) |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: Implement suggested changes from Moshi |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285479 |
Excellent suggestions, thank you! (more) |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: Implement suggested changes from celtschk |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285479 |
That's... a very fair point (more) |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285479 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285479 |
I /could/ remove some bytes by changing `int(sqrt(n)+1)` to `n`, but some part of me really doesn't like sacrificing time complexity like that… (more) |
— | almost 3 years ago |
Edit | Post #285479 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Determine whether an integer is square-free Python3, 39 bytes ```python lambda n:all(n%i2for i in range(2,n)) ``` Try it online! Makes a list comprehension from the numbers `2` through `n` of the remainder of the square, and then checks whether the list contains `0` -8 bytes thanks to celtschk -5 bytes thanks to Moshi (more) |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285271 |
Post edited: |
— | almost 3 years ago |