Skip to content

Commit 46aa6da

Browse files
authored
Add files via upload
1 parent 2e1bbab commit 46aa6da

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

noToCounting.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
def main():
2+
numbers={0:'zero',1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',14:'fourteen',15:'fifteen',16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen',20:'twenty',30:'thirty',40:'fourty',50:'fifty',60:'sixty',70:'seventy',80:'eighty',90:'ninety',100:'one hundred',200:'two hundred',300:'three hundred',400:'four hundred',500:'five hundred',600:'six hundred',700:'seven hundred',800:'eight hundred',900:'nine hundred',1000:'one thoushand',2000:'two thoushand',3000:'three thoushand',4000:'four thoushand',5000:'five thoushand',6000:'six thoushand',7000:'seven thoushand',8000:'eight thoushand',9000:'nine thoushand',10000:'ten thoushand'}
3+
userInput=int(input("Please Enter Any no."))
4+
word=''
5+
size=len(str(userInput))
6+
if userInput>20:
7+
while(size != 0):
8+
temp=int(userInput/10**(size-1))
9+
if temp>0:
10+
word=word+numbers[temp*10**(size-1)]+" "
11+
else:
12+
word=word
13+
userInput=userInput%10**(size-1)
14+
size=size-1
15+
print(word)
16+
elif userInput<-20:
17+
userInput=userInput*-1
18+
word='minus '
19+
while(size != 0):
20+
temp=int(userInput/10**(size-1))
21+
if temp>0:
22+
word=word+numbers[temp*10**(size-1)]+" "
23+
else:
24+
word=word
25+
userInput=userInput%10**(size-1)
26+
size=size-1
27+
print(word)
28+
else:
29+
if userInput<0:
30+
userInput=userInput*-1
31+
word='minus '+numbers[userInput]
32+
print(word)
33+
else:
34+
print(numbers[userInput])
35+
36+
37+
if __name__ =='__main__':
38+
main()

0 commit comments

Comments
 (0)