Skip to main content
deleted 74 characters in body
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135

Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)

Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)

Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)
Commonmark migration
Source Link

#Python, 13

Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)

#Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)

Python, 13

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)
added 130 characters in body
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135

#Python, 13

  

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1
lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14).:

lambda x:x-x%1
lambda x:x-x%1

If using cast to integer instead, it's one character longer than using modulus (15).:

lambda x:int(x)
lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)

#Python, 13

 

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14).

lambda x:x-x%1

If using cast to integer instead, it's one character longer than using modulus (15).

lambda x:int(x)

#Python, 13

 

If the OP wants all functions to be non-anonymous, add f= to the front of each for two additional characters.

lambda x:x//1

Since x%1 returns the amount following the decimal point, this is pretty short (14):

lambda x:x-x%1

If using cast to integer instead, it's one character longer (15):

lambda x:int(x)

The shortest using string casting I could come up with (40):

lambda x:int(`x`.split('.')[0])+cmp(x,0)
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135
Loading