x = input ("Number of Guests: ")
y = input ("Number of beers: ")
print "Full beers per person: " + str(float(y / x))
print "Left over beers: " + str(y % x)
print "Poured into keg and shared: " + str(int(y / x, 3)) +" beer per person"
this is my current python code, i am attempting to get the poured into keg portion to display 3 decimal places but keep getting an error.
Traceback (most recent call last):
File "D:/Charman/GeoProcessing/A2/BeerCalc.py", line 5, in -toplevel-
print "Poured into key and shared: " + str(int(y / x, 3)), +" beer per person"
TypeError: int() can't convert non-string with explicit base
I have been searching and searching for some user friendly advice or tips and I am not too formidable in this language, if anyone can give me some clarification on what im doing wrong I would greatly appreciate it.
thanks
y = input ("Number of beers: ")
print "Full beers per person: " + str(float(y / x))
print "Left over beers: " + str(y % x)
print "Poured into keg and shared: " + str(int(y / x, 3)) +" beer per person"
this is my current python code, i am attempting to get the poured into keg portion to display 3 decimal places but keep getting an error.
Traceback (most recent call last):
File "D:/Charman/GeoProcessing/A2/BeerCalc.py", line 5, in -toplevel-
print "Poured into key and shared: " + str(int(y / x, 3)), +" beer per person"
TypeError: int() can't convert non-string with explicit base
I have been searching and searching for some user friendly advice or tips and I am not too formidable in this language, if anyone can give me some clarification on what im doing wrong I would greatly appreciate it.
thanks
Comment