TGViewer
Data Analyst Interview Resources Data Analyst Interview Resources @dataanalystinterview · 52.6K subscribers
Post #1840 4.13K
Top 10 Python Interview Questions with Solutions ✅

1️⃣ What is the difference between a list and a tuple?
⦁ List: mutable, defined with []
⦁ Tuple: immutable, defined with ()
lst = [1, 2, 3]
tpl = (1, 2, 3)


2️⃣ How to reverse a string in Python?
s = "Hello"
rev = s[::-1]  # 'olleH'


3️⃣ Write a function to find factorial using recursion.
def factorial(n):
    return 1 if n == 0 else n * factorial(n-1)


4️⃣ How do you handle exceptions?
⦁ Use try and except blocks.
try:
    x = 1 / 0
except ZeroDivisionError:
    print("Cannot divide by zero")


5️⃣ Difference between == and is?
⦁ == compares values
⦁ is compares identities (memory locations)

6️⃣ How to check if a number is prime?
def is_prime(n):
    if n < 2:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


7️⃣ What are list comprehensions? Give example.
⦁ Compact way to create lists
squares = [x*x for x in range(5)]


8️⃣ How to merge two dictionaries?
⦁ Python 3.9+
d1 = {'a':1}
d2 = {'b':2}
merged = d1 | d2


9️⃣ Explain *args and **kwargs.
⦁ *args: variable number of positional arguments
⦁ **kwargs: variable number of keyword arguments

10️⃣ How do you read a file in Python?
with open('file.txt', 'r') as f:
    data = f.read()


Python Interview Resources: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L

Tap ❤️ for more
  • ❤ 3
More from @dataanalystinterview
  1. Oct 10, 2026📢 Advertising in this channel You can place an ad via Telega․io. It takes just a few minu…
  2. Oct 9, 2026✅SQL Roadmap: Step-by-Step Guide to Master SQL 🧠💻 Whether you're aiming to be a backend…
  3. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
  4. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  5. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  6. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →