Dumb script to calculate the savings when buying bulk medical flower.
Tried wrapping it in str() to see if that converted it all into a string so it could print().
from prettytable import PrettyTable
print("*Enter with spaces seperating")
oneGP, twoGP, OneEightP, OneFourP, OneHalfP, ozP= map(int, input().split(" "))
x = PrettyTable()
x.field_names = ["1g", "2g", "1/8", "1/4", "1/2" "Oz"]
x.add_row(["$" + oneGP, "$" + twoGP, "$" + OneEightP, "$" + OneFourP,"$" + OneHalfP, "$" + ozP])
x.add_row([oneGP/1, twoGP/2, OneEightP/3.5, OneFourP/7,OneHalfP/14,ozP/28])
print(x)
Traceback (most recent call last): File "main.py", line 10, in x.add_row(["$" + oneGP, "$" + twoGP, "$" + OneEightP, "$" + OneFourP,"$" + OneHalfP, "$" + ozP]) TypeError: can only concatenate str (not "int") to str
x.add_row(["$" + str(oneGP), "$" + str(twoGP), "$" + str(OneEightP), "$" + str(OneFourP),"$" + str(OneHalfP), "$" + str(ozP)])
you tried to concat int to string so this error happens + will work with same type objects so you need to use cast for some cases
or if you don't want to cast use ,
instead of +