Skip to content

Guermoud98/Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Python List Operations Exercises

Exercice 1

This Python program demonstrates various operations that can be performed on a list. The program performs the following tasks:

  • Define a list 'liste' with elements [170, 3.8, 0, 22, 7.2, 55, 18]
  • Sort and print the list.
  • Append '.05' to the list and print the updated list.
  • Reverse and print the list.
  • Remove '3.8' from the list and print the updated list.
  • Print the index of '3.8'.
  • Print the index of '22'.
  • Print the sublist from the 3rd element to the end of the list.
  • Calculate and print the sum of all elements in the list.
  • Calculate and print the product of the 2nd element to the end of the list.
  • Add a for loop to print integers from 0 to 15 (exclusive) in steps of 3 using range() function.

Exercice 2

This Python program contains various functions for manipulating lists. The program performs the following tasks:

  • uniqueElement() : a function that finds the unique elements in a list.
  • unique() : a function that finds the elements common to two lists.
  • length_sup_four() : a function that finds all strings with a length greater than 4.
  • sup_ten() : a function that finds all integers greater than 10 in a list.
  • string_upper_case() : a function that converts strings to uppercase.
  • sum_of_elements() : a function that finds the sum of all the elements in a given list.
  • squareList() : a function that returns a list of the squares of integers.
  • powList() : a function that returns a list of the powers of integers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages