Posts

Showing posts with the label remove duplicates in a list

Python exercise with solutions (Set 3)

Image
  1.To print all prime numbers in a given interval Sample input :  20 Sample Output : 2,3,5,7,11,13,17,19 Code : Output:   2. To check whether the given string is palindrome or not . A palindrome is a word that remains same even after reversing it. The code should print yes if the given word is palindrome and no if it is not a palindrome. Sample input : Madam Sample Output: Yes Code : Output : 3.To remove the duplicates in a list Sample input : [1,2,6,8,2,1,4,6,1,7,9] Sample Output : [1,2,6,8,4,7,9] Code : Output : 4. To print all items that are available for the given cost Sample input : 250 Sample Output : Apple Orange Banana Code : Output : 5.To capitalise the first letter of first name and last name of a person Sample input : henry bacos Sample Output : Henry Bacos Code : Output : For more exercises , 1. Python exercise-1 2. Python Exercise-2 3. Python Exercise-3 For python tutorials , 1. Introduction 2. Conditional statements (if---else...)