Solution Exercise 42: Class Person and child class Student
Exercice 42 Create a Python class Person with attributes: name and age of type string. Create a display() method that displays the name and age of an object created via…
Python Courses & Exercises with solutions !
Exercice 42 Create a Python class Person with attributes: name and age of type string. Create a display() method that displays the name and age of an object created via…
Exercise 41 Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. Create a Perimeter() method to calculate the perimeter of the…
Exercise 41. Rectangle class: || Solution Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. Create a Perimeter() method to calculate…
Exercise 40 Write a Python program that allows you to swap the first and the last word. Example if s = "Python is a programming language", the program returns the…
Exercice 39 Write a Python program that counts the number of words on a string Solution def countWord(s): # convert the string s to a list L = s.split() #…
Exercise 38 Write a Python program to find the longest word on a string. Solution: def longestWord(s): # Converting the string s to a list L = s.split() # define…
Exercise 37 Write a Python program that creates a list whose elements are the common words to two strings s1 and s2. Solution def commonWords(s1 , s2): listCommonWords = []…