Code source Python pour cet exercice: https://www.my-courses.net/2020/10/solution-exercise-59-python-algorithm.html
All python string exercises: https://www.my-courses.net/2019/08/python-practice-exercises-with-solution.html
Écrire un algorithme en Python sous forme de fonction qui détermine la longueur d'une chaîne sans utiliser la méthode len() ni aucune autre méthode prédéfinie en python. Cet exercice a été crée sous Python 3.7 Windows 7, Python 3.7 Windows 8 et Python 3.7 Windows 10.
Pour une visualisation de qualité professionnelle, utilisez le navigateur Google Chrome.
Write an algorithm in Python as a function that determines the length of a string without using the len () method or any other predefined method
in python. This exercise was created in Python 3.7 Windows 7, Python 3.7 Windows 8 and Python 3.7 Windows 10. For the best viewing, use the Google Chrome browser.
Exercices Python: les bases: https://www.tresfacile.net/tp-python-exercices-corriges-dalgorithmique-python-les-bases/
Tous les TP Python avec solutions: https://www.tresfacile.net/tp-python-avec-solutions/
Python Exercises With Solutions : https://www.my-courses.net/p/python-exercises-with-solutions.html
Basic Python Exercises-Solutions:
- Exercises on Strings and Lists: https://www.my-courses.net/2019/08/python-practice-exercises-with-solution.html
- OOP Exercices with solutions: https://www.my-courses.net/2020/02/exercises-with-solutions-on-oop-object.html
- Exercises on Python File I/O: https://www.my-courses.net/2020/03/exercise-on-python-files-io.html
- Python Dictionary Exercises:https://www.my-courses.net/p/python-dictionary-exercises.html
- Python Sets Exercises: https://www.my-courses.net/p/python-set-exercises-with-solutions.html
Python Mathematics Exercises
High School Grade 10
- Python Arithmetic Exercises: https://www.my-courses.net/p/python-arithmetic-exercises-with_13.html
- Equations & System Of Equations: https://www.my-courses.net/p/solving-equations-and-systems-of.html
- Polynomials and Functions: https://www.my-courses.net/p/solving-equations-and-systems-of.html
- High School Grade 11
- Python Arithmetic Exercises: https://www.my-courses.net/p/python-arithmetic-exercises-with_30.html
- Numpy, Matplolib, Sympy , Scipy - Exercises:https://www.my-courses.net/p/python-numpy-exercise-high-school-grade.html
- High School Grade 12
- Python Arithmetic Exercises: https://www.my-courses.net/p/python-arithmetic-exercises-with.html
Methods associated to string
capitalize method: capitalizes first letter of string
center(width, fillchar)
Returns a space-padded string with the original string centered to a total of width columns.
count(str, beg= 0,end=len(string))
Counts how many times str occurs in string or in a substring of string if starting index beg and ending index end are given.
decode(encoding='UTF-8',errors='strict')
Decodes the string using the codec registered for encoding. encoding defaults to the default string encoding.
encode(encoding='UTF-8',errors='strict')
Returns encoded string version of string; on error, default is to raise a ValueError unless errors is given with 'ignore' or 'replace'.
endswith(suffix, beg=0, end=len(string))
Determines if string or a substring of string (if starting index beg and ending index end are given) ends with suffix; returns true if so and false otherwise.
expandtabs(tabsize=8)
Expands tabs in string to multiple spaces; defaults to 8 spaces per tab if tabsize not provided.
find(str, beg=0 end=len(string))
Determine if str occurs in string or in a substring of string if starting index beg and ending index end are given returns index if found and -1 otherwise.
index(str, beg=0, end=len(string))
Same as find method , but raises an exception if str not found.
isalnum method
Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.
isalpha method
Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.
isdigit method
Returns true if string contains only digits and false otherwise.
islower method
Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.
isnumeric method
Returns true if a unicode string contains only numeric characters and false otherwise.
isspace method
Returns true if string contains only whitespace characters and false otherwise.
istitle method
Returns true if string is properly "titlecased" and false otherwise.
isupper method
Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.
join(seq)
Merges (concatenates) the string representations of elements in sequence seq into a string, with separator string.
len(string)
Returns the length of the string
ljust(width[, fillchar])
Returns a space-padded string with the original string left-justified to a total of width columns.
lower method
Converts all uppercase letters in string to lowercase.