generated from mwc/problemset_numberwords
	Initial commit
This commit is contained in:
		
							
								
								
									
										14
									
								
								nw.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								nw.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
# nw.py
 | 
			
		||||
# ------
 | 
			
		||||
# Implements a simple number-to-text command-line interface.
 | 
			
		||||
# Ex: python nw.py 145
 | 
			
		||||
 | 
			
		||||
from argparse import ArgumentParser
 | 
			
		||||
from numberwords import int_under_1000000_to_str
 | 
			
		||||
 | 
			
		||||
parser = ArgumentParser("Print out a number as it is spoken in English.")
 | 
			
		||||
parser.add_argument("number", type=int)
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
text = int_under_1000000_to_str(args.number)
 | 
			
		||||
print(text)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user