Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 3421

A competition to solve a particular problem through the usage and manipulation of numbers.

0 votes

add commas to Numbers without String manipulation

Python 3, 165 chars from math import* b=int(input()) j=10**8 k=l=0 while j>0: z=int(floor(b/j));b-=z*j;k+=1;j=floor(j/10) if not l:l=z!=0 if l:print(z,end=','if k%3==0and j>0 else'') No strings …
Blazer's user avatar
  • 2,232
2 votes

add commas to Numbers without String manipulation

The previous program inserts Ls (python longs) if the number is too large, but is still within the constraints of the challenge. …
Blazer's user avatar
  • 2,232
2 votes

determine longest group of consecutive numbers

Python new: def s(q): i = r = 1 l = -1 for n in q: if n == l + 1: i += 1 elif i > r: r,i = i,1 else: i=1 l=n return i …
Blazer's user avatar
  • 2,232
1 vote

Outputting ordinal numbers (1st, 2nd, 3rd)

n.endswith(e):return n+o n should be a string I know I'm beaten by the competition here already, but I thought I'd provide my idea anyways this just basically generates a list of key, value pairs with number
Blazer's user avatar
  • 2,232
1 vote

Random sampling without replacement

python 2.7 import random print(lambda x,y,z:random.sample(xrange(y,z),x))(input(),input(),input()) not sure what your standing is on using builtin random methods, but here you go anyways. nice and …
Blazer's user avatar
  • 2,232