Solution Exercise 13: Python algorithm to remove duplicate elements from a list
Exercise 13 Write a Python algorithm as a function to remove duplicate elements from a list. Solution
Younes Derfoufi CRMEF OUJDA
Cours Python
Exercise 13 Write a Python algorithm as a function to remove duplicate elements from a list. Solution
Younes Derfoufi CRMEF OUJDA
Exercise 21 Write a Python program to count the number of vowels in a given string. Example for the string s='unconstitutionally' the program must return the following message: "The string unconstitutionally has 8 vowels".
Exercise20 Write a Python program, to swap the first and the last character of a given string. Solution
Younes Derfoufi CRMEF OUJDA
Exercise 19 Write a Python algorithm that list the strings that make up the list l = ["laptop", "iphone", "tablet"] while indicating the length of each string. Solution
Younes Derfoufi CRMEF OUJDA
Exercise 14 Write a python program that asks the user to enter an integer n and display whether this number is a perfect square or not.
Exercise 18 Write a program in Python that asks the user to enter a string of characters s and send back a message indicating whether the string contains the letter 'a' while indicating its position on the string. Example if the user types the string s = 'language' the program returns: The letter 'a' is…
Exercise 17 Write a Python program to display for a given string of characters "s", the number of occurrences of each character in the string "s". Example for the string s = "Python.org" the program should display: The character: "P" appears once in the string s The character: "y" appears once in the string s…
Exercise 6 Write a Python program that returns the length of a given list without using the len() method.
Exercise 2 Write a Python algorithm to swap the first element with the last element of a given list. Example: if L = ["Python", "Java", "C++", "Javascript"], the algorithm returns the list: ["Javascript", "Java", "C++", "Python"]
Exercise 11 Write a program in Python that asks the user to enter an integer n and displays all the divisors of this number.
Exercise 9. Write a program in Python that asks the user to enter an integer n and display n! Solution
Exercise 8 Write a python algorithm that asks the user to enter an integer n and displays the value of the sum 1 + 2 + … + n = ?
Exercise 7 Write a Python algorithm that asks the user to enter 3 numbers x, y and z and display their maximum without using any predefined function.
Exercise 12 By using the sort() method, write an algorithm in python as a function which takes a list L of numbers as a parameter and which returns the tuple (min , max) formed from the minimum and the maximum of the list.
Exercise 12 . 1) – Write a program in Python that asks the user to enter an integer n and display him the multiplication table of this number. 2) – Improve the program so that it displays the multiplication tables of all the numbers between 1 and 9
Exercise 11 Write an algorithm in python as a function which takes as parameters a tuple (L, n) formed by a list L of numbers and an integer n and which returns the list obtained from L by multiplying its elements by n . Example if L = [13, 11, 7, 25] and n =…
Exercise 10 Write an algorithm in python as a function which takes as a parameter a tuple (L, a) formed by a list L and an element 'a' and which returns the position of the element 'a' in the list L. The function must return -1 if the element 'a' is not in the list.
Notifications