L
luke.geelen
hello,
i have been working on a python resistor calculator to let my class show what you can do with python.
now i have a script that makes the more speekable value of the resistance (res)
#if len(str(res)) > 9:
# res2 = res / 1000000000
# print "de weerstand is %s,%s giga ohms" % (res2)
#elif len(str(res)) > 6:
# res2 = res / 1000000
# print "de weerstand is %s,%s Mega ohm" % (res2)
#elif len(str(res)) > 3:
# res2 = res / 1000
# print "de weerstand is", res2,"kilo ohm"
#elif len(str(res)) < 4:
# res2 = res
# print "de weerstand is", res2,"ohm"
i commented it because it doesn't work (yet), when i have a resistance of
9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural number, anyway of using decimals insted so that it says : the resistance is 9.9 Giga Ohms instead of 9 ?
i have been working on a python resistor calculator to let my class show what you can do with python.
now i have a script that makes the more speekable value of the resistance (res)
#if len(str(res)) > 9:
# res2 = res / 1000000000
# print "de weerstand is %s,%s giga ohms" % (res2)
#elif len(str(res)) > 6:
# res2 = res / 1000000
# print "de weerstand is %s,%s Mega ohm" % (res2)
#elif len(str(res)) > 3:
# res2 = res / 1000
# print "de weerstand is", res2,"kilo ohm"
#elif len(str(res)) < 4:
# res2 = res
# print "de weerstand is", res2,"ohm"
i commented it because it doesn't work (yet), when i have a resistance of
9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural number, anyway of using decimals insted so that it says : the resistance is 9.9 Giga Ohms instead of 9 ?