Questions tagged [python]
This challenge is related to the Python language. Note that challenges that require the answers to be in a specific language are generally discouraged.
143 questions
0
votes
1
answer
109
views
Golf a number bigger than all other answers [duplicate]
You have to code in python, and the number generated by your code must be bigger than all other current submissions. You need to make your code as small as possible, it has to terminate but you can ...
4
votes
1
answer
121
views
Python Buckshot Roulette KOTH
What is Buckshot Roulette?
Buckshot Roulette is an indie game, released by Mike Klubnika to itch.io in 2023.
Okay, but how do you play?
To quote from the wiki:
"At its core, Buckshot Roulette is ...
0
votes
1
answer
326
views
How can I shorten this Python code from 214 bytes to under 200 bytes? [closed]
I have the following Python code, which is 214 bytes long:
...
3
votes
5
answers
408
views
Run a board game tournament
You are in charge of running a board game tournament. Unfortunately, you only have one copy of the game and only so much time, so only a limited number of games can be played. Similarly, you have a ...
1
vote
0
answers
90
views
Write a piece of Quine code that can be excuted by both C and Python [duplicate]
Write a piece of code that is compatible with both C and Python compilers/interpreters, which can output its own source code.
Quine is quite easy, but how about this double language version?
Hint:
To ...
0
votes
1
answer
401
views
How can I reduce the characters in the following python code? [closed]
The following code is 47 characters.
print(("Ekki v","V")["COV"in input()]+"eikur!")
How can it be reduced to 46 or less?
I ...
6
votes
4
answers
638
views
Is there a shortest code to format string
Code Golf Challenge
Given a string of 10 characters:
'abcdefghij'
I want to format it in this pattern and print it in the console in a minimum number of characters:
...
18
votes
16
answers
3k
views
Adversarial Iterated Prisoner's Dilemma
In this challenge, you will play the iterated Prisoner's Dilemma, but with a twist: There's also an adversary trying to mess you up!
The Prisoner's dilemma is a scenario in game theory where there are ...
8
votes
1
answer
565
views
Self-referencing tuple in python
Goal: create a self-referencing tuple satisfying x == (x,) in any version of Python. Standard libraries, matplotlib, numpy, pandas only.
Answers meeting this extra ...
5
votes
3
answers
529
views
Valid python function invocation signatures
Background
In Python, function arguments are defined within the parentheses following the function name in the function definition. There are different ways to present function arguments, and they can ...
-3
votes
1
answer
591
views
What is the ABSOLUTE shortest way to write this code?
So I got kinda bored and was wondering if it was possible to make this code shorter without modifying anything except a file named coin.py...
...
17
votes
19
answers
6k
views
The Dating Game / Secretary Problem
The bots are looking for love. Can you help them?
The rules
The goal of this game is find the bot you have the highest compatibility with. However, robots, who are inexperienced at dating are unable ...
6
votes
2
answers
451
views
Shortening this Code to process nested tuple even further without the use of max()
I have the code:
...
27
votes
14
answers
3k
views
Is this series of quotes valid Python?
Python string parsing has quite a few edge cases. This is a string:
"a"
Putting 2 strings immediately after each other implicitly concatenates them, so ...
9
votes
2
answers
692
views
Inverting string-based binary number in one line in Python
I want to read two strings on separate lines, each string the same length and containing only 0's and 1's, and determine if the first is the one's complement of the second. How succinctly can this be ...