PY3

Capitalize the entire first field of standard input with Python

#!/usr/bin/python3
import sys,re
for line in sys.stdin:
word=line.split()
word1=re.split("\s",line)[0]
word1=word1.upper()
print(str(word1)," ".join(word[1:]),end=" ")
print()

Get a constellation name from given celestial coordinates

#!/usr/bin/python3

import sys
from astropy import units as u
from astropy.coordinates import SkyCoord, get_constellation 
coord=sys.argv[1:]
co=" ".join(coord)
c=SkyCoord(co, unit=(u.hourangle,u.deg))
print(get_constellation(c,short_name=False))

Egyptian fractions in Python 3

Express a rational number as the sum of unit fractions.Maze

Generate an ASCII maze with Python

Pi range

Calculate 500 digits of pi starting at the 99,501st digit, with #Python

from sympy import * str(N(pi,100000))[-500:]

Spell out numbers with Python:

pip install inflect
import inflect
inflector=inflect.engine() print(inflector.number_to_words(8675309))

Reformat standard input to any width with Python


#!/usr/bin/python3
import sys
import textwrap
w=int(sys.argv[1])
for line in sys.stdin:
print(textwrap.fill(line,width=w))