← 30 Days of Python
Day 1 / 30Basics

Python Basics — Variables, Data Types & Print

Every Python interview for a data analyst role starts with these. Know your data types cold — interviewers use these to filter out candidates who have only watched tutorials without writing code.

1
Easy

What are the main data types in Python?

Python Answer
int, float, str, bool, list, tuple, dict, set
💡

For data analytics, you will mostly work with int and float (numbers), str (text/column names), bool (True/False filters), list and dict (structured data). Know which is mutable and which is not.

2
Easy

What is the difference between int and float?

Python Answer
x = 10      # int — whole number
y = 10.5    # float — decimal number
type(x)     # <class "int">
type(y)     # <class "float">
💡

When you read a CSV with Pandas, numeric columns with decimals become float64, whole numbers become int64. Knowing this helps you debug dtype errors.

3
Easy

How do you check the type of a variable?

Python Answer
x = 42
print(type(x))   # <class "int">

df["salary"].dtype   # in Pandas — dtype("int64")
💡

type() is for plain Python objects. In Pandas, use .dtype on a Series or .dtypes on a DataFrame to check column types before transformations.

4
Easy

What is the difference between = and == in Python?

Python Answer
x = 10        # assignment — stores value in variable
x == 10       # comparison — returns True or False
💡

Using = when you meant == inside a condition causes a SyntaxError in Python (unlike some languages). This catches beginners. In Pandas: df[df["age"] == 25] — always ==.

5
Easy

How do you convert a string "123" to an integer?

Python Answer
s = "123"
n = int(s)    # 123
f = float(s)  # 123.0
💡

Type conversion is common when reading data from CSVs or APIs where numbers arrive as strings. Pandas usually handles this automatically, but manual conversion is needed for edge cases.

6
Easy

What does the print() function do and how do you format output?

Python Answer
name = "Priya"
age = 25
print(f"Name: {name}, Age: {age}")   # f-string (preferred)
print("Name: {}, Age: {}".format(name, age))   # .format()
💡

f-strings (Python 3.6+) are the cleanest way to format output. In data analysis you use them for logging results, printing summaries, and building dynamic report messages.

EVIKA ACADEMY · PYTHON FOR DATA ANALYTICS

Want to master Python with live practice?

Join our Python for Data Analysis course — live classes in Noida and online across India.

Book Free Demo Class →
NEXT →Day 2: Strings — Manipulation & Methods
Best Data Analytics Course in Noida Delhi NCR | EVIKA ACADEMY