Boost your Python skills with these practice questions and answers from Day 1 of learning Python for Data Science. Perfect for beginners looking to master Python basics! Read more
These topics were covered in Day 1 article It is important to practice your learning in order to solidify your knowledge.
site = 'CuriousCLub.in'
description ='CuriousClub.in offers extensive learning resources on Python, SQL, Data Visualization, Excel, and job alerts to help users upskill and find career opportunities.'
number_of_article = 1000
@, $, %
) and since Python is a case sensitive language name
and Name
are considered as two different variables.name = 'your name'
Name = 'please provide your full name'
print(name) # Output: your name
print(Name) # Output: please provide your full name
Since Python distinguishes between uppercase and lowercase letters, changing the capitalization of a variable name creates a new, separate variable.
x = 10
in Python without declaring a type? x = 10
in without declaring a type, Python automatically determines the data type based on the assigned value. Since 10
is a whole number, x
will be assigned the integer (int
) type.x = 10
print(type(x)) # Output: <class 'int'>
This code swaps the values of a
and b
, so the output will be:
10, 5
#
symbol and are used to add brief explanations within the code.# This is a single-line comment
x = 10 # Assigning value to x
'''
or """
) and are used for longer explanations or documentation."""
This is a multi-line comment.
It can span multiple lines.
"""
print("Hello, World!")
Temporarily Disabling Code
x = 10
# y = 20 # Disabling this line to check for errors
print(x)
Explaining Complex Logic
# Checking if the number is even or odd
if x % 2 == 0:
print("Even")
else:
print("Odd")
Tracking Issues
# TODO: Optimize this loop for better performance
for i in range(1000):
print(i)
#
in Python? #
symbol in Python is used to create single-line comments. Anything written after #
on the same line is ignored by the Python interpreter and does not affect code execution.# Assigning values
x = "Python"
y = 3.14
print(x, y)
Python 3.14
The print(x, y)
statement prints the values of x
and y
, separated by a space.
print()
function. name
, age
, and city
. Assign them your name, age, and city respectively. Then, use the print()
function to display their values in a sentence.name = 'Vishal'
age = 27
city = 'Delhi'
print(f'My name is {name}, i am {age} years old, I am from {city}.')
x
and y
. Assign any two numbers to them. Calculate their sum, difference, product, and quotient. Print each result.x, y = 5, 10
print('Sum of x and y is :',x+y)
print('Difference of x and y is :',x-y)
print('Product of x and y is :',x*y)
print('Qoutient of x and y is :',x/y)
Sum of x and y is : 15
Difference of x and y is : -5
Product of x and y is : 50
Quotient of x and y is : 0.5
a = 3
and b = 5
, after swapping a
should be 5 and b
should be 3.a = 3
b = 5
a, b = b, a
print(a)
print(b)
5
3
# this is a single line of comment.
'''
This is a multiline comment.
line 2 of comment.
'''
language = 'Python'
print(language)
integer = 58
float_ = 34.34
string = 'string'
print(integer)
print(float_)
print(string)
58
34.34
string
variable = 10
print(type(variable))
variable = 10.5
print(type(variable))
variable = 'Ten'
print(type(variable))
<class 'int'>
<class 'float'>
<class 'str'>
fruit, price, weight = "Apple", 20, 3.14
print(fruit,"|", price,"|", weight )
Apple | 20 | 3.14
This concludes Chapter 1. In the next chapter, we will explore Python’s data types and operations in detail.
You can also check out our podcast on this topic:
Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers Practice Questions and Answers
We hope this article about Practice questions for day 1 of Learning Python for Data Science was helpful for you and you learned a lot of new things from it. If you have friends or family members who would find it helpful, please share it to them or on social media.
Join our social media for more.
Hi, I am Vishal Jaiswal, I have about a decade of experience of working in MNCs like Genpact, Savista, Ingenious. Currently i am working in EXL as a senior quality analyst. Using my writing skills i want to share the experience i have gained and help as many as i can.
Tableau for Beginners: Measures and Dimensions - A Comprehensive Tutorial Welcome to the world of…
Embark on your data science journey with our Day 1 guide to learning Python for…
Master your Amazon SQL Interview Questions! This article reveals the key SQL concepts and question…
Data Analyst Interview Questions:- Get insights into Data Analyst interview questions at Flipkart. Learn about…
Understanding SQL query execution plans is crucial for performance tuning. Learn how execution plans work,…
Learn how single-column indexes work in SQL, when to use them, and how they improve…