Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

"Python Basics: Variables and Data Types Explained"

Rating
-
Sold
-
Pages
7
Uploaded on
28-02-2025
Written in
2024/2025

This document provides an introduction to variables and data types in Python. It covers how to declare and use variables, different data types such as integers, floats, strings, lists, tuples, dictionaries, and booleans, and best practices for working with them. The document is designed for beginners who want to build a strong foundation in Python programming.

Show more Read less
Institution
Course

Content preview

PYTHON
 Python is simple and easy.
 Free and open source.
 High level language.
 Developed by Guido van Rossum.
 Portable.

o Ex.,
Print(“Hello World”)


Python Character Set
 Letters – A to Z, a to z
 Digits – 0 to 9
 Special Symbols - +,-,*,/ etc.
 Whitespaces – Blank space,tab,carriage
return,newline,formfed
 Other characters – Python can process all ASCII and
Unicode characters as part of data or literals

o Ex.,
Print(“Sai is my name.”, “My age is 19.”)

Output : Sai is my name .
My age is 19.

o Ex.,
Print(20)
Output : 20

Variables
A variable is a name given to a memory location in a program.

, Name = “Sai”
Age = 20
Price = 25.99

o Ex.,
name = “Sai”
age = 20
price = 25.99
print(name)

Output : Sai

Rules for Identifiers
1. Identifiers can be combination of uppercase and lowercase
letters,digits or an underscore(_).
So myVariable, variable_1,variable_for_print all are valid
python identifiers.
2. An identifier can not start with digit . So while variable1 is
valid , 1variable is not valid.
3. We can’t use special symbols like !,#,@,%,$ etc in our
identifier.
4. Identifier can be of any length.

Data Types
 Integer
 String
 Float
 Boolean
 None

o Ex.,
age = 20
old = True

Connected book

Written for

Institution
Course

Document information

Uploaded on
February 28, 2025
Number of pages
7
Written in
2024/2025
Type
Class notes
Professor(s)
Prof.samrin
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
samrin

Get to know the seller

Seller avatar
samrin SPPU
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions