This challenge is intended to utilize the Python language as a means of solving a problem. However, language-specific challenges are generally discouraged on CG.

learn more… | top users | synonyms

29
votes
26answers
4k views

Tips for golfing in Python

What general tips do you have for golfing in Python? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Python (e.g. "remove comments" is ...
5
votes
28answers
2k views

Sum of positive integers. (Spoj - SIZECON)

Problem: Given a set of integers, find the sum of all positive integers in it. Input: t – number of test cases [t < 1000] On each of next t lines, an integer N [-1000 ≤ N ≤ 1000] Output ...
7
votes
1answer
400 views

What is the minimum set of characters with which you can write any valid python program?

The proof of the set of characters is that there is a translator which takes any ascii python program as input and produces a limited character set version of the program. The limited character set ...
1
vote
1answer
727 views

Shortest Way of creating a basic Space Invaders Game in Python

Hello all code golfers: Your challenge is to create a basic version of Space Invaders in Python Rules Program must be not written in Py3K All levels must be randomly generated There must be a HUD ...