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

Popular posts from this blog

Write a python script to display the current date and time. First create variables to store date and time, then display date and time in proper format (like: 13-8-2022 and 9:00 PM """