Embark on your data science journey with our Day 1 guide to learning Python for Data Science. Understand Python’s key features, variable assignments, and the importance of comments in coding. Read more
Python is a high level and versatile programming language known for its readability and simplicity. It is widely used in various fields, including web development, data science, artificial intelligence, and automation.
Created in the late 1980s by Guido Van Rossum, it has grown into one of the most popular languages for beginners and expert programmers. Vast libraries, dynamic typing, and cross-platform compatibility are key reasons for its popularity.
Variables act as containers for storing data values, it can also be defined as variables are the names that holds values which can be used and modified throughout the program.
Naming Rules: Unlike other languages, Python does not require explicit declaration of variable types but there are a few rules about naming the variables, that must be followed.
must start with
eighter with a letter
or an underscore
(_)
. They cannot start with a number.can contain letters, numbers, and underscore only
, cannot contain special characters.case sensitive
language, hence name
and Name
are treated as different variables
.x = 10
name = "Python"
pi = 3.14
Python also allows to create multiple variables at the same time.
a, b = 5, 10
print(a, b)
5 10
Using the same method values from these variables can be swapped.
a, b = b, a
print(a, b)
10 5
Comments are used to add notes or explanations to codes without affecting its execution. They help make the code more readable and understandable, especially for complex logic or when working in a team. Comments are ignored by Python interpreter.
These comments begin with # symbol and continue to the end of the line. They are typically used for short explanations or clarify specific lines of code.
# this is a comment.
x = 5 # Assigning value to x
Multiline comments are often created using triple quotes (”’ or “””). While triple quotes are typically used for multiline strings they can also serve as multiline comments until they are not assigned to a variable.
"""
This is a multi-line comment.
It can span multiple lines.
"""
print("Hello, World!")
It is important to practice your learning in order to solidify your knowledge.
x = 10
in Python without declaring a type?#
in Python?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.x
and y
. Assign any two numbers to them. Calculate their sum, difference, product, and quotient. Print each result.a = 3
and b = 5
, after swapping a
should be 5 and b
should be 3.The answer for these is shared here: click here for answers
This concludes Chapter 1. In the next chapter, we will explore Python’s data types and operations in detail.
We hope this article about 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…
Boost your Python skills with these practice questions and answers from Day 1 of learning…
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…