Interview question of list in python,practice question of list in python
#Write a python program to store all the programming languages known to you using
#Set
a={"python","java","javascript","c++"}
print(type(a))
# Write a python program to store your own information {name, age, gender, so on..}
a={"rajendra",18,"male"}
print(a)
#Write a Python script to find if “Python” is present in the set thisset = {"Java",
#"Python", "Django"}
thisset={"java","python","Django"}
print("python"in thisset)
#Write a python program to add items from another set to the current set. thisset =
#{"Java", "Python", "SQL"}
#secondset= {"C", "Cpp", "NoSQL"
a={"java","python","sql"}
b=("c","cpp","nosql")
print(a.union(b))
#Write a python program to add elements of list to a set
#thisset = {"Python", "Django", "JavaScript"}
#mylist = ["Java", "C"]
thisset={"python","django","javascript"}
mylist=["java","c"]
thisset.update(mylist)
print(thisset)
#Write a python program to remove last item of the given set
#thisset = {"Python", "Django", "JavaScript", “SQL"
thisset={"python","Django","javascript","SQL"}
thisset.remove("SQL")
print(thisset)
#Write a python program to loop through the set and print values
#thisset = {"Python", "Django", "JavaScript", “SQL”}
a={"python","Django","javascript","SQL"}
for i in a:
print(i)
# Write a python program to find the maximum and minimum value in a set.
a={1,2,3,4,5}
print(max(a))
print(min(a))
#. Write a python program to delete the set completely
a={1,2,3}
a.clear()
print(a)
Comments
Post a Comment