0% found this document useful (0 votes)
5 views

SBL 2 A16

Uploaded by

Anushree Idekar
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)
5 views

SBL 2 A16

Uploaded by

Anushree Idekar
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
You are on page 1/ 7

ANUSHREE IDEKAR SE EXTC A16

Aim: Write a programs to understand datatypes, Expressions, Input


and Output functions.
Software: IDLE PYTHON
THEORY: Data types are the classification or categorization of data
items. It represents the kind of value that tells what operations can be
performed on a particular data. Since everything is an object in Python
programming, data types are actually classes and variables are instance
(object) of these classes.

NUMERIC:
In Python, numeric data type represents the data which has numeric
value. Numeric value can be integer, floating number or even complex
numbers. These values are defined as int, float and complex class in
Python.
SEQUENCE:
In Python, sequence is the ordered collection of similar or different
data types. Sequences allows to store multiple values in an organized
and efficient fashion. There are several sequence types in Python –
• String
• List
• Tuple

BOOLEAN:
Data type with one of the two built-in values, True or False. Boolean
objects that are equal to True are truthy (true), and those equal to False
are falsy (false). But non-Boolean objects can be evaluated in Boolean
context as well and determined to be true or false. It is denoted by the
class bool.Note – True and False with capital ‘T’ and ‘F’ are valid
booleans otherwise python will throw an error.
SET:
In Python, Set is an unordered collection of data type that is iterable,
mutable and has no duplicate elements. The order of elements in a set
is undefined though it may consist of various elements.
Creating Sets
Sets can be created by using the built-in set () function with an iterable
object or a sequence by placing the sequence inside curly braces,
separated by ‘comma’. Type of elements in a set need not be the same,
various mixed-up data type values can also be passed to the set.
DICTIONARY:
Dictionary in Python is an unordered collection of data values, used to
store data values like a map, which unlike other Data Types that hold
only single value as an element, Dictionary holds key:value pair. Key-
value is provided in the dictionary to make it more optimized. Each key-
value pair in a Dictionary is separated by a colon:, whereas each key is
separated by a ‘comma’.
Creating Dictionary
In Python, a Dictionary can be created by placing a sequence of
elements within curly {} braces, separated by ‘comma’. Values in a
dictionary can be of any datatype and can be duplicated, whereas keys
can’t be repeated and must be immutable. Dictionary can also be
created by the built-in function dict(). An empty dictionary can be
created by just placing it to curly braces {}.
Note – Dictionary keys are case sensitive, same name but different
cases of Key will be treated distinctly.
SYNTAX:
NUMERIC

STRING DATA TYPE


LIST DATA TYPE
PROGRAM AND OUTPUT:
CONCLUSION:
BY PERFORMING THIS EXPERIMENT, WE LEARN ABOUT
DIFFERENT DATATYPES AND THEIR CONVERSIONS.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy