Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 693 Bytes

7. Unit 1 - Lesson 7.md

File metadata and controls

33 lines (28 loc) · 693 Bytes

Dictionaries

Q1. 1,5

Data Type Conversions

Q1.

a = int(input("Enter a value: "))
b = int(input("Enter b value: "))
# print a value respective string
print(str(a))
print(chr(a))
print(hex(a))
print(complex(a,b))
# print a value respective char
# print a value respective hexadecimal value
# print a and b of complex number

Q2.

list1 = ["key1","key2","key3"]
list2 = ["value1","value2","value3"]
print(list1)
print(list2)
mydict = zip(list1,list2)	# using zip() function we can create dictionary with two lists(one list for keys and one list for values)

# convert dictionary into set using set() method
a=set(mydict)
print(sorted(a))


# print elements in  sorted order