9. Data Types & Variables - Type Conversion & Casting

Published: 29 July 2026
on channel: Tech-With-Saurabh
3
0

Data Types & Variables — Type Conversion & Casting | Python for Beginners (Video 9)

Numbers arriving as text, floats that need to become whole numbers, results that need to be embedded in sentences — the data you work with isn't always in the type you need. In this video, you'll learn how to deliberately change a value from one data type to another using Python's built-in casting functions — with live code and real examples
throughout.

In this video, you'll learn:
✅ The difference between implicit conversion (Python does it automatically) and explicit conversion — also called casting (you do it deliberately)
✅ The int() function — converting strings and floats to integers, including the truncation behaviour of int(3.9) that surprises almost every beginner
✅ Why int() always truncates toward zero and never rounds — and why this matters
✅ The float() function — converting integers and strings to decimal numbers
✅ The str() function — converting numbers to text for string concatenation
✅ What a ValueError is — and when Python raises one during a failed conversion
✅ A complete real-world example: string data converted to numeric types, calculated, then converted back to strings for clean output

📌 Your action step after this video: write a program that asks the user for a product name, its price as a decimal, and a quantity — cast the price to float() and the quantity to int(), calculate the total, and print a formatted receipt using str() for the concatenation.

👍 If this helped you, like, subscribe, and turn on notifications — next up, we cover Booleans and Truthy/Falsy Values.

#Python #LearnPython #PythonForBeginners #CodingForBeginners #PythonTutorial #TypeConversion


On this page of the site you can watch the video online 9. Data Types & Variables - Type Conversion & Casting with a duration of hours minute second in good quality, which was uploaded by the user Tech-With-Saurabh 29 July 2026, share the link with friends and acquaintances, this video has already been watched 3 times on youtube and it was liked by 0 viewers. Enjoy your viewing!