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

Data Analytics Internship Assignment

Good source to read

Uploaded by

jagpreet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Data Analytics Internship Assignment

Good source to read

Uploaded by

jagpreet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

6/9/24, 4:51 PM UM_06_June.

ipynb - Colab

keyboard_arrow_down Python Basic Terms


Syntax (valid and invalid)
Comments

print('Unified Mentor')

Unified Mentor

name = 'Rohit' # This is my name


print(name)

Rohit

keyboard_arrow_down Python Data Types, Type Casting & Variables


Text Type: str
Numeric Types: int, float
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set
Boolean Type: bool

name = 'Rohit'
age = 25
height = 5.9

type(name)

str

type(age)

int

type(height)

float

student1 = ['Rohit',25, 5.9] # List method. Can modify it.

student1

['Rohit', 25, 5.9]

type(student1)

list

student2 = ('Aman',23,5.6) # Tuple method. Cannot modify it.

student2

('Aman', 23, 5.6)

type(student2)

tuple

student3 = {'Shweta',24,5,5.3} # Set method. Random output.

student3

https://colab.research.google.com/drive/1libjRp7M5JQuTUjVrU7j8YSE10Tb0HMS#scrollTo=1sbEX8vQRosU&printMode=true 1/4
6/9/24, 4:51 PM UM_06_June.ipynb - Colab

{24, 5, 5.3, 'Shweta'}

type(student3)

set

student4 = {'Name':'Vishal', 'Age':25, 'Height':5.8} #Dictionary method. Use key:value pair to store data

student4

{'Name': 'Vishal', 'Age': 25, 'Height': 5.8}

student4['Name']

'Vishal'

student4.keys()

dict_keys(['Name', 'Age', 'Height'])

student4.values()

dict_values(['Vishal', 25, 5.8])

type(student4)

dict

print(range(10))

range(0, 10)

bool(1)

True

bool(0)

False

keyboard_arrow_down Python Operators


Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Membership Operators

# Arithmetic Operators( +,-,*,/,%,**) # Used with nemuric values to perform common mathematical operat

x= 10
y= 3

print(x+y)

13

print(x-y)

print(x*y)

30

https://colab.research.google.com/drive/1libjRp7M5JQuTUjVrU7j8YSE10Tb0HMS#scrollTo=1sbEX8vQRosU&printMode=true 2/4
6/9/24, 4:51 PM UM_06_June.ipynb - Colab
print(x/y)

3.3333333333333335

print(x%y)

print(x**y)

1000

# Assignment Operators (=,+=,-=,*=,/=,%=,**=) # Used to assign values to variables

x, y = 10, 3

# print(x = y, x+=y, x-=y, x*=y, x/=y, x%=y, x**=y)

x += y
print(x)

13

# Comparison Operators (==, !=, <, >, <=, >=) # Used to compare two values

x = 10
y = 3

print(x == y)
print(x != y)
print(x < y)
print(x > y)
print(x <= y)
print(x >= y)

False
True
False
True
False
True

# Logical Operators (AND, OR, NOT) # Used to combine conditional statements

x = 10
y = 3

print(x > y and x < 20)


print(x > y or x < 20)
print(not(x > y and x < 20))

True
True
False

# Membership Operators ( in , not in) # Used to test if a sequence is presented in an object.

x = ['apple', 'banana']
y = 'apple'

print(y in x)
print(y not in x)

True
False

https://colab.research.google.com/drive/1libjRp7M5JQuTUjVrU7j8YSE10Tb0HMS#scrollTo=1sbEX8vQRosU&printMode=true 3/4
6/9/24, 4:51 PM UM_06_June.ipynb - Colab
# finding substring
name = 'Management'
a = 'age'

a in name

True

https://colab.research.google.com/drive/1libjRp7M5JQuTUjVrU7j8YSE10Tb0HMS#scrollTo=1sbEX8vQRosU&printMode=true 4/4

You might also like