coding vibes: data Typoes and vairables

Day 3: Variables, Data Types & Input/Output (I/O)

Welcome back to Day 2 of the Python 60 Days Job-Ready Bootcamp – Powered by Coding Vibes!

In this session will learn about python “variables”, “data types” and how to handle input and output from user.

🛠️ What You’ll Learn

  • Declaring variables and assigning values
  • Understanding data types: int, float, str, bool
  • Taking user input with input()
  • Displaying clean output with print() and f-strings
  • Type casting (int(), float(), str()) and type checking (type())

💡 Variables: Your Data Containers

name = "Kaustav"     # str
age = 41             # int
height = 5.6         # float
is_beginner = True   # bool

print(name, age, height, is_beginner)

🔎 Data Types in Python

print(type(10))        # <class 'int'>
print(type(3.14))      # <class 'float'>
print(type("Hello"))   # <class 'str'>
print(type(True))      # <class 'bool'>

⌨️ Input & Output

user_name = input("Enter your name: ")
user_age = int(input("Enter your age: "))

print("Hi", user_name, "- next year you’ll be", user_age + 1)
print(f"Hi {user_name}, next year you’ll be {user_age + 1}.")  # f-string

🔁 Type Casting & Checking

price = "19.99"            # str
price_num = float(price)   # 19.99
qty = int("3")             # 3
total = price_num * qty    # 59.97

print(f"Total = {total}")
print(type(total))         # <class 'float'>

🚀 Mini Project: Quick Profile

name = input("Name: ")
age = int(input("Age: "))
gpa = float(input("GPA (e.g., 3.75): "))
is_learner = input("Are you learning Python? (yes/no): ").strip().lower() == "yes"

print("\n--- Profile ---")
print(f"Name: {name}")
print(f"Age next year: {age + 1}")
print(f"GPA: {gpa:.2f}")
print(f"Learning Python: {is_learner}")

🔗 Useful Links


Next up (Day 4): Operators & Control Flow basics—arithmetic, comparison, logical operators, and more.

copyright@CodingVibes

Tags: No tags

Add a Comment

Your email address will not be published. Required fields are marked *