-
Python Program to Find the Largest Number in a List
-
Python Program to Find the Second Largest Number in a List
-
Python Program to Put Even and Odd elements in a List into Two Different Lists.
-
Python Program to check whether two lists are same.
-
Python Program to Find the Union of Lists.
-
Python Program to Find the Intersection of Lists.
-
Python Program to find union and intersection of lists without repetition.
-
Python Program to Create a List of Tuples with the First Element as the Number and Second Element as the Square of the Number.
-
Python Program to Remove the Duplicate Items from a List.
-
Python Program to Read a List of Words and Return the Length of the Longest One.
-
Python Program to Add a Key-Value Pair to the Dictionary
-
Python Program to Concatenate Two Dictionaries Into One
-
Python Program to Check if a Given Key Exists in a Dictionary or Not
-
Python Program to Generate a Dictionary that Contains Numbers (between 1 and n) in the Form (x,x*x).
-
Python Program to Sum All the Items in a Dictionary
-
Python Program to Multiply All the Items in a Dictionary
-
Python Program to Remove the Given Key from a Dictionary
-
Write a function is_empty(my_dict) that takes a dictionary my_dict and returns True if my_dict is empty and False otherwise.
-
Write a function make_dict(key_value_list) that takes a list of tuples key_value_list where each tuple is of the form (key, value) and returns a dictionary with these keys and corresponding values.
-
A simple substitution cipher is an encryption scheme where each letter in an alphabet to replaced by a different letter in the same alphabet with the restriction that each letter's replacement is unique. The template for this question contains an example of a substitution cipher represented a dictionary CIPHER_DICTIONARY. Your task is to write a function encrypt(phrase,cipher_dict) that takes a string phrase and a dictionary cipher_dict and returns the results of replacing each character in phrase by its corresponding value in cipher_dict.
CIPHER_DICT = {'e': 'u', 'b': 's', 'k': 'x', 'u': 'q', 'y': 'c', 'm': 'w', 'o': 'y', 'g': 'f', 'a': 'm', 'x': 'j', 'l': 'n', 's': 'o', 'r': 'g', 'i': 'i', 'j': 'z', 'c': 'k', 'f': 'p', ' ': 'b', 'q': 'r', 'z': 'e', 'p': 'v', 'v': 'l', 'h': 'h', 'd': 'd', 'n': 'a', 't': ' ', 'w': 't'}
encrypt("cat", CIPHER_DICT) should return ”km “
-
Write a function make_cipher_dict(alphabet) that takes a string of unique characters and returns a randomly-generated cipher dictionary for the characters in alphabet . You should use the shuffle() method in the random module to ensure that your returned cipher dictionary is random.
-
Write a python code to generate grade using dictionary. Dictionary should have student names as keys (assuming names are unique) and subject_name and mark as value. There are 5 subjects for each student. Marks should be converted to grades (90 – 100 A+, 80-89 A etc).