• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Class notes

"Python Basics: Variables and Data Types Explained"

Document preview thumbnail
Preview 2 out of 7 pages

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.

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
 image
Deepali Srivastava Ultimate Python Programming
Publisher: 2024 ISBN: 9789355516558 Edition: Unknown

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
$8.49

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

Sold
0
Followers
0
Items
1
Last sold
-



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