Okay, I started learning Python last weekend on Saturday with some tutorials and a book.
With this being my first programming language my program won't amaze you :P
The program I made is a calculator for working out how much turf a person would need given the length and the width of the area. It can add an extra 5% extra for 'Trimming & Wastage' and it suggests an amount after rounding up the total number.
print "*************************"
print "Turf Calculator v1.0.0"
print "*************************"
import math
turf = True
while turf:
print "\n-------------------------\n"
length = input("Enter Length: ")
print "\n-------------------------\n"
width = input("Enter Width: ")
print "\n-------------------------\n"
first = length * width
second = first / 9.0
total = second / 1.196
add = raw_input('Add 5% for Trimming and Wastage? (Y/N): ')
print "\n-------------------------\n"
if add != 'y' and add != 'Y':
print "Total: " + "%.2f" % total + " Rolls\n"
print "Suggested Amount: " + `math.ceil(total)`
print "\n-------------------------\n"
elif add == 'y' or 'Y':
final = total * 0.05
last = total + final
print "Total: " + "%.2f" % last + " Rolls\n"
print "Suggested Amount: " + `math.ceil(last)` + " Rolls"
print "\n-------------------------\n"
end = raw_input('Re-run Program? (Y/N): ')
if end != 'y' and end != 'Y':
turf = False
Let me know what i could improve, add, remove or whatever else you think i should know.
One thing i would like to change if i can is, when they say yes to re-run the program, if it could completely reset and not leave previous results, if anybody understands what i mean.
Anyway, let me know what you think or if i missed anything :)
Cheers