Why is Weight being classified as a string and how can I make it and int

weight = input("What is the weight of your package? " + "= ")

#For true user interaction, use the code above

#weight = 63
#Ground Shipping

print(type(weight))
#this prints out <class (str)> which then gives me a typeError for “if weight <= 2;” which is two lines below.

cost_ground = “”

if weight <= 2:

cost_ground = weight * 1.50 + 20.00

elif weight <= 6 :

cost_ground = weight * 3.00 + 20.00

elif weight <= 10:

cost_ground = weight * 4.00 + 20.00

else:

cost_ground = weight * 4.75 + 20.00

print(“The cost of the groung shippment plan” + " = " , cost_ground)

cost_ground_premium = 125.00

print(“Your premium cost” + " = " , cost_ground_premium)

cost_drone = “”

if weight <= 2:

cost_drone = weight * 4.50 + 0.00

elif weight <= 6 :

cost_drone = weight * 9.00 + 0.00

elif weight <= 10:

cost_drone = weight * 12.00 + 0.00

else:

cost_drone = weight * 14.25 + 0.00

print(“The cost of your drone shippment plan” + " = " , cost_drone)

input() provides a string as it’s return value. If you need weight to be an int then a this is easily converted by casting it explicitly:

weight = int(input("What is the weight of your package? " + "= "))

Be sure to add some error handling here though, like what if the user provides input that cannot be converted to an int!