this code was a conversion from my prevous code i have written in C, what i like from python are it simplicity.... as you can compare from my prevous code
|
this code was a conversion from my prevous code i have written in C, what i like from python are it simplicity.... as you can compare from my prevous code
|
after visiting allaboutalgoritma, i've interested seeing their change currency, so i decided to convert it in python. forgive me if you're confused with the language cause it's indonesian
#change currency program
print "welcome to my change currency program"
amount = input("your money amount")
result=amount/100000
rest=amount%100000
print "your change amount"
print result, "seratusribuan"
if (rest>=50000):
result=rest/50000
rest=rest%50000
print result, "limapuluhribuan"
if (rest>=20000):
result=rest/20000
rest=rest%20000
print result, "duapuluhribuan"
if (rest>=10000):
result=rest/10000
rest=rest%10000
print result, "sepuluhribuan"
if (rest>=5000):
result=rest/5000
rest=rest%5000
print result, "limaribuan"
if (rest>=1000):
result=rest/1000
rest=rest%1000
print result, "seribuan"
if (rest>=500):
result=rest/500
rest=rest%500
print result, "limaratusan"
if (rest>=100):
result=rest/100
rest=rest%100
print result, "seratusan"
else:
print "rupiah"
|
this was the basic exercise in GUI programming, in here i make a empty window using wxpython
|
nanti hasilnya seperti gambar di bawah ini
here was an wxpython calculator taht i've copied from http://pythonwise.blogspot.com/2006/05/wxpython-calculator-in-50-lines-of.html , and written by Miki Tebeka
|
here is a super simple (easy to understand) age counter, which ask for username input, birthday, and recent date. i'm adding some commentation function in the end of the code
|