Datatype and Conversion - PMD091023 (10/10/23)

Info About Karan
email---->string
(roll_no)---->int
(subject_marks)----> dict
(is_boy)----> bool
(fav_fruits)—>set
(height)---->float
(friends)---->list
(dob)---->tuple
(have_any_scars)------>None

Create a variable with data into it and find out the type of each variable. Use the type which i have written.

you have time till you join the session tomorrow.

Hi Zeba,

Please find my code below ,


# String
Email_str = 'testemail@gmail.com'
type(Email_str)
o/p : str

#Interger
rollno_int = 114231
type(rollno_int)
o/p: int

#Dictionaries
subjectmarks_dict = {"English": (89,90,91,92,93,94,95,96,97,98),
                     "Tamil" : (89,90,91,92,93,94,95,96,97,98),
                     "Maths" : (90,91,92,93,94,95,96,97,98,99),
                     "Social" :(89,90,91,92,93,94,95,96,97,98),
                     "Science" : (89,90,91,92,93,94,95,96,97,98)
                     }
type(subjectmarks_dict)
o/p: dict

#Boolean
booleancheck = 5 > 2
type(booleancheck)
o/p : bool

#Set
fruits_set = {'apple','orange','grapes','pineapple'}
type(fruits_set)
o/p: set

#Float
length_float = 15.50
type(length_float)
o/p : float

#List
friends_list = ['Anitha','Balaji','Devi','Ashok']
type(friends_list)
o/p : list

#Tuple
month_tuple = ('January',4,'Aug', 'December')
type(month_tuple)
o/p: tuple

#None
questions_if_any = None
type(questions_if_any)
o/p: NoneType

Thanks

1 Like

Email_id = “karan.python@yahoo.com

print(type(Email_id))

roll_no = 52

print(type(roll_no))

subject_marks = {(“English”,“Maths”,“Science”) : [90,99,85]}

print(type(subject_marks))

Is_karan_a_boy = True

print(type(Is_karan_a_boy))

karan_favfruit = {‘Apple’,‘Litchi’}

print(type(karan_favfruit))

karan_height = 5.8

print(type(karan_height))

karan_friends = [‘Ajay’,“Prateek , Nishant”]

print(type(karan_friends))

karan_dob = (19,‘December’,1999)

karans_dob = (19,12,1999)

print(type(karan_dob),type(karans_dob))

have_anyscar = None

print(type(have_anyscar))

1 Like

Email----> String
email = “karana56@outlook.com
(roll_no)–> int
roll_no = 1456
(subject_marks)—> dict
subject_marks = {“english”:81, “Maths”:97, “Science”:95}
(is_boy)---->bool
output : false
(fav_fruits)—>set
fav_fruit = {‘mangoes’, ‘apple’, ‘banana’}
(height)—>float
height = 34.890
(friends)—list
friends = [“peter”, “john”, “mary”, “king”]
(dob)—>tupe
karan_scores_dob = (97, 81, 95)
type(karan_scores_dob)
output : tuple
(have_any_scars)------>None
have_any_scars = None
print(type(have_any_scars))

1 Like

Hi @zk6290254938
Please find my screenshot of the same.

1 Like

Program and output

1 Like

Thank you all for your participation.
@praneethreddygadipel @Yadidi981 @anjalidalal.work @palakchanana.pc @mythelimanoharan @FarhanShaikh

I would like to see more number of participation in everyday practice questions.

1 Like

Mahendra Deore

#string
Email_str = “deoremahendra11@gmail.com
type(Email_str)
#string
Email_str = “deoremahendra11@gmail.com
type(Email_str)
str
Num_int)
#Integer
Num_int = 55
type(Num_int)
int
#Dictionary
Count_Dict = {“Orange”:(50,20),“Mango”:(70,65),“Kiwi”:(45,20)}
type(Count_Dict)
#Dictionary
Count_Dict = {“Orange”:(50,20),“Mango”:(70,65),“Kiwi”:(45,20)}
type(Count_Dict)
dict

#boolean
Bool1 = (55*5==100)
type(Bool1)
bool
type(Num_fl)
#float
Num_fl = 33.5
type(Num_fl)
float
#List
list_num = [1,“Summer”,2,5,“Winter”]
type(list_num)
list
data)
#tuple
Tuple_data = (1,“money”,2,“Health”)
type(Tuple_data)
tuple
}
#set
Num_set = {1,4,5}
type(Num_set)
set
type(Now1)
#None
Now1 = None
type(Now1)
NoneType

1 Like

String

Email = “Sujathareddy@gmail.com

type(Email)

Int

RollNumber = 119

type(RollNumber)

#Dict

Dictionary ={

"Name ": “SUjatha”,

“Address”:“Hyderabad”,

"Year ": “1994”

}

type(Dictionary)

#Bool

X = 5>2

type(X)

#Set

Fav_Fruits ={

“Apple”,“Banana”,“Orange”

}

type(Fav_Fruits)

#Float

Height = 5.6

type(Height)

#List

Friends=[

“Sujatha”,“Surekha”,“Susmitha”

]

type(Friends)

#Tuple

DOB =(

“1994”,“1995”,“1997”

)

type(DOB)

1 Like

Email_id = “karan001.python@yahoo.com”

print(type(Email_id))

roll_no = 52

print(type(roll_no))

subject_marks = {(“English”,“Maths”,“Science”) : [90,99,85]}

print(type(subject_marks))

Is_karan_a_boy = True

print(type(Is_karan_a_boy))

karan_favfruit = {‘Apple’,‘Litchi’}

print(type(karan_favfruit))

karan_height = 5.8

print(type(karan_height))

karan_friends = [‘Ajay’,“Prateek , Nishant”]

print(type(karan_friends))

karan_dob = (19,‘December’,1999)

karans_dob = (19,12,1999)

print(type(karan_dob),type(karans_dob))

have_anyscar = None

print(type(have_anyscar))

1 Like