
Python Basics
Variables, data types, control structures, functions, modules, exceptions
1What is a variable in Python?
What is a variable in Python?
Answer
A variable in Python is a name that refers to a memory location containing a value. Unlike other languages, Python uses dynamic typing: the variable type is automatically determined during assignment. There is no need to explicitly declare the type.
2What is the type of the value 3.14 in Python?
What is the type of the value 3.14 in Python?
Answer
In Python, 3.14 is a floating-point number, so it is of type float. Integers (without decimals) are of type int, while numbers with a decimal part are automatically considered float. The type() function can be used to check a value's type.
3How to convert the string "42" to an integer in Python?
How to convert the string "42" to an integer in Python?
Answer
The int() function converts a string representing a number to an integer. This operation is called casting or type conversion. If the string does not represent a valid number, a ValueError will be raised. There is also float() for decimals and str() for strings.
What is the difference between a list and a tuple in Python?
What does the expression bool("") return in Python?
+22 interview questions
Other Data Science & ML interview topics
Python Object-Oriented Programming
Python Data Structures
Git Fundamentals
SQL Basics
NumPy Fundamentals
Pandas Basics
Jupyter & Google Colab
SQL Joins & Advanced Queries
Advanced Pandas
Visualization with Matplotlib & Seaborn
Interactive Visualizations with Plotly
Descriptive Statistics
Inferential Statistics
Web Scraping
BigQuery & Cloud Data
Feature Engineering
Supervised ML: Regression
Supervised ML: Classification
Decision Trees & Ensembles
Unsupervised ML
ML Pipelines & Validation
Time Series & Forecasting
Deep Learning Fundamentals
TensorFlow & Keras
CNN & Image Classification
RNN & Sequences
Transformers & Attention
NLP & Hugging Face
GenAI & LangChain
MLOps & Deployment
Master Data Science & ML for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free