Variables and Data Types

Casting (2 marks)

Study the code below. Identify where casting is used and why it might be useful in this context. quantity = input(“Enter number of products: “) total_cost = input(“Enter total cost of products: “) average_cost = float(total_cost) / int(quantity) print(“Average Cost:”, average_cost)

Casting (2 marks) Read More »

Shopping Cart