Python Operators
Contenu du cours What is Python operators Arithmetic operators Assignment Operators Comparison Operators Logical Operators Bitwise Operators 1. What is…
Cours Python Complet + 500 Exercices Avec Solutions
Contenu du cours What is Python operators Arithmetic operators Assignment Operators Comparison Operators Logical Operators Bitwise Operators 1. What is…
Content Waht is a Python comment ? Single-line comments Multi-line comments Why use python comments 1. Waht is a Python…
Content Defining a Python variable Variable Naming Conventions Types of python variables Convert or change the type of a python…
Content About Python language Python language features Who use Python ? How can we use python ? Graphical interface GUI…
Content Step 1: Downloading and Installing Python Step 2: Choosing and Installing an IDE Step3: creation of a first Python…
Content What is an IDE ? VSCode IDE PyCharm IDE Spider IDE Jupyter Notebook Wing IDE PyDev IDE IDLE 1.…
Content Choosing a Python Distribution Install Python 2.1 Install Python On Linux 2.2 Install Python On Windows First Program Python…
Exercise 21 Write a Python program to count the number of vowels in a given string. Example for the string…
Exercise20 Write a Python program, to swap the first and the last character of a given string. Solution
1 2 3 4 5 6 7 8 9 10 11 12 | # define an example of string s s = "Python" # get the length of the string s n = len(s) # get the first character of the string s first = s[0] last = s[n-1] # extract the substring obtained from s ignoring the first and the last character s1 = s[1:n-1] # construct a new string by changing the first and last character s2 = last + s1 + first print(s2) # output: 'nythoP' |
…