Skip to content

Instantly share code, notes, and snippets.

@girisagar46
Created August 5, 2018 02:45
Show Gist options
  • Save girisagar46/07a81cb9529f79eb8a2835e20ec2a6b2 to your computer and use it in GitHub Desktop.
Save girisagar46/07a81cb9529f79eb8a2835e20ec2a6b2 to your computer and use it in GitHub Desktop.
1. Write a Python script to concatenate following dictionaries to create a new one. Go to the editor
Sample Dictionary :
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50,6:60}
Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
2. Given a dictionary:
my_dictionary = {
"a": 1,
"b": True,
"c": [1, 2, 3, 4],
"d": {"Hello": 5, "World": 5}
}
Do the following:
- add a key "xyz" to the my_dictionary.
- check if the key "pqe" already exists in a dictionary.
- get all the values from my_dictionary
- Remove the key "xyz" from a my_dictionary
3. Given a list my_list = list(range(0, 10)). Sum all the values in the my_list
4. Given a list another_list = [4, 5, 9, 1, 0, 2, 3], find the max and minimum value from the another_list
5. Write a Python program to remove duplicates from a list.
6. Write a Python program to check a list is empty or not.
7. Write a Python program to print a specified list after removing the 0th, 4th and 5th elements.
Sample List : ['Red', 'Green', 'White', 'Black', 'Pink', 'Yellow']
Expected Output : ['Green', 'White', 'Black']
8. Given a list a = [1, 2, 3, 4]. Ask another integer value from the user and append it to a.
9. Given two list:
a = [1, 2, 3, 4, 5, 5, 6]
b = [4, 3, 2, ,5 , 6, 7]
Collect the unique and similar elements and build another list.
10. Write a Python program to find the index of an item in a specified list.
11. Write a Python program to convert a list of multiple integers into a single integer.
Sample list: [11, 33, 50]
Expected Output: 113350
12. How can you find the length of a dictionary
13. Write a Python program to create a tuple with different data types.
14. Write a python program to convert a list to a tuple.
15. Write a python program to convert a list to a set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment