[Go to site: main page, start]

0% found this document useful (0 votes)
11 views21 pages

Python Variables DataTypes

This document outlines the basics of Python programming, focusing on variables, data types, and console input/output. It covers topics such as naming and assigning variables, their scope, and different data types including numeric, sequence, boolean, and dictionary types. The document also includes an assignment for creating and printing variable types.

Uploaded by

kalisubrata609
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views21 pages

Python Variables DataTypes

This document outlines the basics of Python programming, focusing on variables, data types, and console input/output. It covers topics such as naming and assigning variables, their scope, and different data types including numeric, sequence, boolean, and dictionary types. The document also includes an assignment for creating and printing variable types.

Uploaded by

kalisubrata609
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON

PROGRAMMING

21 Days Challenge
Day-02
Day-02

Python Basics and Fundamentals - Variables, Data Types &


Console Input / Output
Instructor
Abdullah Al Zubaer
Instructor – Artificial Intelligence & Data Science
[Link]. in Internet of Things and Robotics Engineering
Gazipur Digital University, Gazipur, Bangladesh
Table Of Content

Python Variables

Input and Output

Data Types

01
Python Variables

Variables are containers for storing data values.


x = 10 name = ‘gobeshona’

02
Python Variables (Contd…)
Naming Variables Delete a Variable

Assigning Values Scope of a Variable

Type of Variable

03
Naming Variables

• Start with letter or _


• Use letters, digits, _
• No start with digit
• No special characters or keywords
• Case-sensitive (Data ≠ data)

04
Assigning Values

• x = 5
• a = b = c = 100
• a, b, c = 1, 1.5, 'zubaer'

05
Type of Variables
Type of Variable

type()

a = "5" → type(a)
b = 10 → type(b)

06
Delete a Variables

x = 100
del x
print(x) → Now x is undefined.

07
Scope of Variables

Local Variable Global Variable

def func(): x = 10
x = 5
print(x) def func():
print(x)
func()
print(x) func()
print(x)

08
Taking User Input

input()
name = input("Enter your name: ")
number = int(input("Enter your number: "))

09
Print Output

print()
print("Hello!", name, " Welcome to Gobeshona Learning")

10
Data Types
Numeric Types Set Types

Text Type Boolean Type

Sequence Types Binary Types

Mapping Type

11
Numeric Data Types

int : x = 10

Float : pi = 3.14

Complex : z = 2 + 4j

12
Sequence Data Types

list : x = ["apple", "banana", "cherry"]

tuple : x = ("apple", "banana", "cherry")

range : x = range(6)

string : name = "bangladesh"

13
Boolean Data Types

bool : x = True

bool : x = False

14
Dictionary and Sets Data Types

dict : x = {"name" : "John", "age" : 36}

set : x = {“apple", "banana", "cherry"}

15
ASSIGNMENT
Create three variables (name, age, height) to store your name, age, and
height then print the type of each variable using the type() function.

16
QUESTION SESSION
[Link]
THANK YOU
[Link]

You might also like