Python Sets and Dictonaries
HindiDic={
"kaam":"work",
"aam":"mango",
"kitab":"book",
"naam":"name"
}
print("Option are",HindiDic.keys())
print("the value of the dictionary is ",HindiDic.values())
a=input("Enter the hindi words:\n")
print("English meaning is :",HindiDic.get(a))
n1=int(input("Enter the number1:\n"))
n2=int(input("Enter the number2:\n"))
n3=int(input("Enter the number3:\n"))
n4=int(input("Enter the number4:\n"))
n5=int(input("Enter the number5:\n"))
n6=int(input("Enter the number6:\n"))
n7=int(input("Enter the number7:\n"))
n8=int(input("Enter the number8:\n"))
number_set={n1,n2,n3,n4,n5,n6,n7}
print(number_set)
number_set.add(200)
number_set.add((25,50,150,456))
print(number_set)
a=int(input("Enter the value :\n"))
b=input("Enter the values:\n")
ab_set={a,b}
print(ab_set)
s={18,'18'}
print(s)
s=set()
s.add(20)
s.add("20")
s.add(20.0)
print(len(s))
print(s)
myfriend={}
languague1 = input("Enter yours fav computer languague:\n")
languague2 = input("Enter yours fav computer languague:\n")
languague3 = input("Enter yours fav computer languague:\n")
languague4 = input("Enter yours fav computer languague:\n")
myfriend["upendra"]=languague1
myfriend["ram"]=languague2
myfriend["shaam"]=languague3
myfriend["upendra"]=languague1
print(myfriend)
myfriend["upendra"]="c++"
myfriend.update({"nitesh":"cout"})
print(myfriend)
No comments:
Post a Comment