Social Icons

Monday, October 19, 2020

Python-courses-python-exercises-python-exception-python-pip

Exercise 55

Write a python program as a function which takes as parameters a string s and which returns a string obtained from the string s by transforming each uppercase character into a lowercase character and vice versa without using the swapcase() method. Example if s = "Hello Wordls!" , the function returns the string "hELLO wORLD!"

Solution

def mySwapcase(s):
    
    # initializing the swapped string
    s_swap = ""
    
    # iterate over all characters of s 
    #and testing if the character is in uppercase or lowercase
    for x in s:
        if x.isupper():
            
            # swapping the character
            x = x.lower()
            s_swap = s_swap + x
        elif  x.islower():
            # swapping the character
            x = x.upper()
            s_swap = s_swap + x
        else:
            s_swap = s_swap + x
            
    return s_swap

# test and display result
print(mySwapcase("Hello World !")) # The output is : hELLO wORLD !


Younes Derfoufi
my-courses.net

Sunday, October 18, 2020

Python-courses-python-exercises-games-Python-courses-

Exercise 53

Using Exercise 51, create a python program as a function which takes as a parameter a string s and which returns the same string in lowercase without using the lower() method. You can use the chr() and ord() methods.

Solution

def toLowercase(s):
    # by using the exercise 51 we can obtain the lists of all upercase characters and lowercase characters:
    uppercase_characters = [chr(i) for i in range(65 , 91)]
    lowercase_characters =  [chr(i) for i in range(97 , 122)]
    # then we can obtain a lowercase characters from uppercase characters by adding 32 to its ascii code
    
    # initializing the searched string
    s_lower = ""
    for x in s:
        if x in uppercase_characters:
            x = chr(ord(x) + 32)
            s_lower = s_lower + x
        else :
            s_lower = s_lower + x
            
    return s_lower
print(toLowercase("PYTHON COURSES"))
# The output is : python courses


Younes Derfoufi
my-courses.net
Python-courses-python-exercises-games-Python-courses-

Exercise 52

Using Exercise 51, create a python program as a function which takes as a parameter a string s and which returns the same string in uppercase without using the upper() method. You can use the chr() and ord() methods.

Solution

def toUppercase(s):
    # by using the exercise 51 we can obtain the lists of all upercase characters and lowercase characters:
    uppercase_characters = [chr(i) for i in range(65 , 91)]
    lowercase_characters =  [chr(i) for i in range(97 , 122)]
    # then we can obtain a uppercase charcter from lowercase character by by subtracting 32 to its ascii code
    
    # initializing the searched string
    s_upper = ""
    for x in s:
        if x in lowercase_characters:
            x = chr(ord(x) -32)
            s_upper = s_upper + x
        else:
            s_upper = s_upper + x
            
    return s_upper
print(toUppercase("Python Programming"))
# The output is : PYTHON PROGRAMMING


Younes Derfoufi
my-courses.net
Python-courses-download-Python-courses-s-Python-courses

Exercise 51

Using ascii code, write a python program that returns and displays the list of all uppercase characters [A, B, C, ..., Z] and the list of all lowercase characters [a, b, c,. .., z]

Solution

  • The ascii codes for the characters A, B, C, ... , Z are: 65 , 66 , ..., 90 
  • The ascii codes for the characters a, b, c, ... , z are:  , 97 ,98 ..., 122
  • To  get a character from ascii code we use the chr() method. Then:
list_uppercase_characters = [chr(i) for i in range(65 , 91)]
list_lowercae_characters =  [chr(i) for i in range(97 , 122)]
print("The list of uppercase characters is : " , list_uppercase_characters)
print("The list of lowercase characters is : " , list_lowercae_characters)
#The output is : 
"""
The list of uppercase characters is :  ['A', 'B', 'C', 'D', 'E', 
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
The list of lowercase characters is :  ['a', 'b', 'c', 'd', 'e', 
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 
's', 't', 'u', 'v', 'w', 'x', 'y']
"""


Younes Derfoufi
my-courses.net
Python-courses-python-exercises-games-Python-courses-

Exercise 50

Write a python program as a function which takes a string s as a parameter and returns the list of numeric characters contained in the string s. Example if s = 'Python 3.0, released in 2008, and completely revised in 2020' the function returns the list: [3, 0, 2, 0, 0, 8, 2, 0, 2, 0].

Solution

def extractNumbers(s):
    # initializing extracted list numbers
    L = []

    for x in s:
        if x.isnumeric():
            x = int(x)
            L.append(x)
    return L
s = 'Python 3.0, released in 2008, and completely revised in 2020'
print(extractNumbers(s))
# The output is : [3, 0, 2, 0, 0, 8, 2, 0, 2, 0]


Younes Derfoufi
my-courses.net

Saturday, October 17, 2020

Python-courses-python-exercises-games-Python-courses-

Exercise 49

Write a Python program as a function that counts the number of times a character appears in a string without using any predefined functions.

Solution

def caracter_count(s , c):
    # initializing counter
    counter = 0
    for x in s:
        if c == x:
            counter = counter + 1
    return counter

# Testing function
s = "python programming"
print("The number of times of appearance of character 'n' in 's' is  = " ,caracter_count(s , 'n'))
# The output is : The number of times of appearance of character 'n' in 's' is  =  2


Younes Derfoufi
my-courses.net
python-tutorial-Python-courses-python-exercises

Exercise 48

Write a program as a function which takes as parameters a pair of strings (s1, s2) and which returns the string s obtained by concatenating in an alternative way the characters of s1 and s2. Example for (s1, s2) = ("Python" , "Java") the function returns the string s = 'PJyatvha'

Solution

# creating a function which test if given word contains at least one uppercase character
def concatenation(s1 , s2):
    # initializing the concatenated string s
    s = ""
    n = len(s1)
    
    m = len(s2)
    if n < m :
        for i in range(0 , n):
            s = s + s1[i] + s2[i]
        s = s + s2[n+1 : m]
    else:
        for i in range(0 , m):
            s = s + s1[i] + s2[i]
        s = s + s2[m+1 : n]        
        
    return s
print("The concatenated string is s = " ,concatenation("Python" , "Java"))

# The output is : The concatenated string is s =  PJyatvha


Younes Derfoufi
my-courses.net

Friday, October 16, 2020

Python-courses-python-exercises-python-certification

Exercise 47

Write a python program that determines the list of all the words which contains at least one uppercase character in a given text T. Example if T = "Python is a high level programming language. Originally developed by Guido van Rossum in 1989." The program returns the list:
['Python', 'Originally', 'Guido', 'Rossum']

Solution

# creating a function which test if given word contains at least one uppercase character
def testUpercase(s):
    # initializing counter
    counter = 0
    for letter in s:
        if letter.isupper():
            counter = counter + 1
    if counter > 0:
        return True
    else:
        return False

T = "Python is  a high level programming language. Originally developed by Guido van Rossum in 1989."

# initializing the list of all the words which contains at least one uppercase character
listUpper = []

# transform the text T to a list
L = T.split()

for word in L:
    if(testUpercase(word)):
        listUpper.append(word)

# display the list         
print(listUpper)
# The output is : ['Python', 'Originally', 'Guido', 'Rossum']


Younes Derfoufi
my-courses.net

Thursday, October 15, 2020

Python-courses-python-exercises

Exercise 46

Write a Python program as a function which takes as parameter a string s and which returns the list of all the words contained in s whose length is greater than or equal to 8. Example if s = 'Python is oriented programming language. Python is the most used programming language'. The function returns the words list :
['oriented', 'programming', 'language', 'programming', 'language']

Solution

def selectWords(s):
    # initialize the list we are looking for  
    L = []
    
    # getting the list of word contained in s
    listWords = s.split()
  
    # select all word of length >= 8
    for word in listWords:
        if len(word) >=8:
            L.append(word)
    return L
   
# testing algorithm
s = 'Python is oriented programming language and the most used programming language '

print('List of all word whose lenght is >= 8 is list_word = ' , selectWords(s))
# The output is : 
# List of all word whose lenght is >= 8 is list_word =  ['oriented', 'programming', 'language', 'programming', 'language']


Younes Derfoufi
my-courses.net

Wednesday, October 14, 2020

Python-courses-neighborhood-Python-courses-bin-Python-courses-python-string

Exercise 45

Write a python program as a function which takes as parameters a character string s and which returns another string obtained from s by replacing all the characters in upper case by the diese char '#'

Solution

def removeUpper(s):
    # create an empty string 
    s1 = ""
    for x in s:
        if x.isupper():
            s1 = s1 + '#'
        else:
            s1 = s1 + x
    return s1
# testing algorithm
s = "Python Language is created by Guido Van Rossam"

print(removeUpper(s))
# The output is : #ython #anguage is created by #uido #an #ossam


Younes Derfoufi
my-courses.net

Tuesday, October 13, 2020

python exercises with solutions python-courses python programming

Exercise 44

Write a python program which groups in a list all the words which begin with a capital letter in a given string s.
Example for s = "Python is a high level programming language. Originally developed by Guido van Rossum in 1989." The program should return the list:
["Python", "Originally", "Guido", "Rossum"]

Solution

s = "Python is a high level programming language. Originally developed by Guido van Rossum in 1989."
L = s.split()

# initializing the list all words which begin with a capital letter 
word_capital = []
for word in L:
    if word[0].isupper():
        word_capital.append(word)
                
# disply result
print("The list of word bgining by capital letter  is word_capital =  " , word_capital)
#The output is:
# The list of word bgining by capital letter  is word_capital =   ['Python', 'Originally', 'Guido', 'Rossum']


Younes Derfoufi
my-courses.net
Programming-Python-courses-programming techniques as well as OOP.

Exercise 43

Write a python program that asks the user to enter the height and base of a triangle and returns the area of the triangle.

Solution

# ask user to enter height of triangle
h = float(input("Enter height value of triangle  : "))

# ask user to enter base of triangle
b = float(input("Enter base value of triangle  : "))

# calculatigng the area of triangle
area = b*h/2

# disply result
print("The area of triangle is Area = " , area)
# Example for h = 7 and b = 8 the out put is :
# The area of triangle is Area =  28.0


Younes Derfoufi
my-courses.net
This installs Python at preferred area -Python-courses-usr-Python-courses

Exercise 42

Write a python program that asks the user to enter numbers separated by semicolons ';' and generates a list make up of the entered numbers.

Solution

# ask user to enter som numbers
numbers = input("Enter some numbers separated by semicolons : ")

# creating a list from entered numbers
listNumbers = numbers.split(';')

# disply result
print("List of entered numbers : " , listNumbers)
# Example for the numbers entered : 10 ; 25 ; 37 ; 2 ; 11
# The output is : List of entered numbers :  ['10 ', ' 25 ', ' 37 ', ' 2 ', ' 11']


Younes Derfoufi
my-courses.net

Monday, October 12, 2020

python courses − Python exercises and packages

Exercise 205

Given the following set of numerical tuples:
E = {(12, 3 , 7 , 11) , (2, 9 , 5 , 13) , (1, 4 ,8)}
Write a Python program that creates a set F whose elements are (Tuple , average of Tuple). Exemple for the set E cited above, the output must be:
F =  {((2, 9, 5, 13), 7.25), ((12, 3, 7, 11), 8.25), ((1, 4, 8), 4.333333333333333)}

Solution

E = {(12, 3 , 7 , 11) , (2, 9 , 5 , 13) , (1, 4 ,8)}
# creating a function that determines the average of given tuple
def averageTuple(T):
    n = len(T)
    Sum = 0
    for i in range(0 , n):
        Sum = Sum + T[i]
    average = Sum/n
    return average

# initializing the set F
F = set({})
for Tuple in E:
    F.add((Tuple , averageTuple(Tuple)))
# Testing algorithm
print("The searched set is F = " , F)


Younes Derfoufi
my-courses.net

Sunday, October 11, 2020

Python is a need to for college kids and running specialists to emerge as a amazing software program Engineer-Python-courses-
specially while they-Python-courses-re running in net improvement area. i can list down some of the key-Python-courses-
advantages of mastering Python-Python-courses--Python-courses-
Python is Interpreted − Python is processed at runtime by using the interpreter. You do no longer need to
assemble your application before executing it. this is much like PERL and personal home page.
Python is Interactive − you may definitely take a seat at a Python set off and have interaction with the
interpreter directly to write down your applications-Python-courses-
Python is object-oriented − Python helps item-oriented style or technique of programming-Python-courses-
that encapsulates code inside objects-Python-courses-
Python is a beginner-Python-courses-s Language − Python is a excellent language for the novice-level programmers-Python-courses-
and helps the improvement of a wide variety of packages from simple textual content processing to WWW-Python-courses-

Exercise 204

Write a Python program as function which takes as parameters two sets E and F, such that E included in F and returns the complement of F in E. Example if
E = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}
and
F = { 'c', 'd', 'e',  'h'}
The function returns:
{'a', 'b', 'f', 'g'}

Solution

def complemntSets(E , F):
    
    # initializing the complment of set F
    Complement_F = set({})
    
    for x in E:
        if x not in F:
            Complement_F.add(x)
            
    return Complement_F

# Testing algorithm
E = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'} 
F = { 'c', 'd', 'e',  'h'}
print("Complement_F = " , complemntSets(E , F))
# display: Complement_F =  {'f', 'g', 'a', 'b'}


Younes Derfoufi
my-courses.net
Unix -Python-courses-Solaris, Linux, FreeBSD, AIX, HP-Python-courses-UX

Exercise 203

Write a python program as a function that determines the union of two sets without using any predefined functions. Example if
E = {"Lenovo", "Hp", "del" , "Accent" , "Asus"}
and
F = {"Acer", "Thomson"}
, the function returns the set:
{"Lenovo", "Hp", "del" , "Accent" , "Asus" , "Acer", "Thomson"}

Solution

def unionSets(E , F):
    
    # initializing the union of sets
    E_union_F = set({})
    # adding all element of E to the union
    for x in E:
        E_union_F.add(x)
    
    # adding all element of F to the union 
    for x in F:
        E_union_F.add(x)
    
    return E_union_F

# Testing algorithm
E = {"Lenovo", "Hp", "del" , "Accent" , "Asus"} 
F = {"Acer", "Thomson"}
print("E_union_F = " , unionSets(E , F))
# display: E_union_F =  {'Lenovo', 'Thomson', 'Acer', 'Hp', 'del', 'Accent', 'Asus'}


Younes Derfoufi
my-courses.net
python-courses-python-exercises-python-tutorials-python-formation

Covered Python Programming principle with many MCQ, quick query answer.
research Python Offline is a an smooth to apply, person-pleasant platform to research Python. Get started in Python with unique and to the factor Python tutorials that are easy to understand and apprehend.

it's miles a full package for Python programming. Its carries tutorials to analyze, mcqs to check your understanding, coding questions to improve your logic and get used to the Python fashion of coding and final however now not the least a light-weight Interpreter so you can practice Python programming as you study. This app no longer best makes a speciality of coding, however additionally allows to reinforce your common sense by way of going through statistics structures and algorithms and how those information systems are implemented. You examine from simple principles to greater enhance principles. i.e. algorithms and data systems the usage of Python programming
learn Python Offline- educational and Programming affords a unique coding floor for you, in which you can take a look at your own coding skills as you analyze.
the academic training are divided into comprehensive sections for fast and clean gaining knowledge of.
No previous programming experience is needed

features:
• without a doubt unfastened.
• fully Offline for research.
• clean language
• contains all simple concepts of Python Programming.
• blanketed all simple theory of Python Programming.
• almost one hundred+ MCQ.
• almost one hundred+ brief query solution.
• easy to understand each and each principles of Python Programming.
• person friendly pics UI (consumer Interface).

Contents blanketed:

• Python introduction
• Compiler and Interpreter
• Python enter and Output
• Python First software
• Python comment
• Python Variables
• Python facts types
• Python number
• Python listing
• Python String
• Python Tuple
• Python Dictionary
• Python Operators
• Python If Else
• Python Loops
• Python ruin maintain and bypass assertion
• Python characteristic
• Python local and worldwide Variable
• Python Module
• Python record dealing with
• Python Exception coping with
• Python class and object
• Python Constructor
• Python Inheritance
• Python Overloading
• Python Encapsulation
• Python normal Expression
• Python Multithreading
• Python Socket Programming
• Python searching
• Python Bubble type
• Python Insertion sort
• Python Merge kind
• Python choice type




my-courses.net
python-courses-python-exercises-python-tutorials-python-formation

With this App you do not want net connection to study about Python three idea. This educational will provide all and sundry who's interested by studying Python 3 all he want to end up expert in python at no cost. in case you are student who is getting ready for exams approximately python or programmer how seeking out programming task, this app is maid for you. looking for an app to get you commenced on python? appearance no similarly as we've evolved this app with the novices in thoughts! We go through each topic right from scratch and supplement them with enough examples. the educational classes are divided into complete sections for immediate and easy studying. No earlier programming revel in is needed even a amateur can study Python effortlessly. version 1.6 of this application lets in you to examine offline concept Python 3. regarding application permissions, you simply have to click on on considered one of them to look the list of prolonged permissions. The descriptions are more precise and provide greater transparency, that's constantly a bit extra considerable. Examples of solutions of sports and practice troubles inside the Python programming language, along with regarded algorithms (binary search, Euclidean set of rules, sieve of Eratosthenes, factorial calculation, Fibonacci collection, finding the greatest not unusual divisor and the least not unusual a couple of). some examples contain precise remarks. presently, we're protecting following all this topics: Python 3 - review
Python 3 - environment Setup
Python three - primary Syntax
Python three - Variable types
Python three - simple Operators
Python three - selection Making
Python 3 - Loops
Python three - Numbers
Python three - Strings
Python three - Lists
Python 3 - Tuples
Python three - Dictionary
Python three - Date & Time
Python three - functions
Python three - Modules
Python three - documents I/O




my-courses.net
The direction variable is named as direction in Unix or route in home windows -Python-courses-Unix is case touchy-Python-courses- windows isn-Python-courses-t always-Python-courses-.
In Mac OS, the installer handles the course info. To invoke the Python interpreter from any specific listing, you should add the Python listing on your direction.
placing course at Unix-Python-courses-Linux
to add the Python listing to the direction for a specific consultation in Unix −
in the csh shell − type setenv direction -Python-courses-$route-Python-courses--Python-courses-usr-Python-courses-neighborhood-Python-courses-bin-Python-courses-python-Python-courses- and press enter.
inside the bash shell -Python-courses-Linux-Python-courses- − type export course=-Python-courses-$route-Python-courses--Python-courses-usr-Python-courses-local-Python-courses-bin-Python-courses-python-Python-courses- and press enter.
inside the sh or ksh shell − kind path=-Python-courses-$route-Python-courses--Python-courses-usr-Python-courses-neighborhood-Python-courses-bin-Python-courses-python-Python-courses- and press input.
notice − -Python-courses-usr-Python-courses-neighborhood-Python-courses-bin-Python-courses-python is the path of the Python directory
setting course at windows
to feature the Python directory to the path for a selected session in home windows −
at the command activate − kind course %route%-Python-courses-C-Python-courses-Python and press input.
observe − C-Python-courses-Python is the course of the Python directory

Exercise 202

Write a program in python as a function which examines whether two sets are disjoint or not. If the two sets are disjoint, the function must return True and False if not.

Solution

def examineSet(E , F):
    # using and initializing a counter
    counter = 0
    # we test if there is a common element of E and F and incrementing the counter
    for x in E:
        if x in F:
            counter +=1
    if counter > 0:
        return True
    else:
        return False  

# Testing algorithm
E = {"Java", "Python", "Javascript", "C ++", "C #"} 
F = {"VB.ET", "Java", "Kotlin", "Python"}
print(examineSet(E , F)) # display True

G = {"Zend Framework", "Django", "Flask"}
H = {"AngularJS",  "Ionic Framework" , "ReactJS"}
print(examineSet(G , H)) # display False


Younes Derfoufi
my-courses.net
C-Python-courses- >python script.py -Python-courses- home wbuiltintegrated/DOS
be aware − make certabuiltintegrated the record permission mode built-in execution.
built-included improvement built-ings
you could run Python from a Graphical user Interface -Python-courses-GUI-Python-courses- built-in as nicely, when you have a GUI application on your built-in that helps Python.
Unix − IDLE is the very first Unix IDE for Python.
integrated − PythonWintegrated is the primary built-indowsintegrated built-interface for Python and is an IDE with a GUI.
Macintegratedtosh − The Macbuilt-intosh model of Python built-in conjunction with the IDLE IDE is to be had from built-inintegrated built-internet siteintegrated, downloadable as both MacBbuilt-inary or BintegratedHex-Python-courses-d documents.
builtintegrated aren-Python-courses-t capable of set upintegrated the environmentintegrated nicely, then you can take help from your built-in admbuilt-in. built-inintegrated the Python built-in is well built-installation and built-ing flawlessly nice.
observe − all the examples given integrated next chapters are built-in with Python 2.4.3 model available on CentOS flavor of Lbuilt-inux.
We already have set upintegrated Python Programmintegratedg environmentintegrated online, so that you can execute all the available examples on-line on the identical time when you are masterbuiltintegrated prbuiltintegrated. experience unfastened to adjust any built-instanceintegrated and execute it on line.

Exercise 201

Write a python program as a function that determines the minimum and maximum values of given a set withowt using any predefined function. Example if
E = {13 , 2 , 47 , 23 , 71 , 17}
, the function returns (2,71)

Solution

def minMax(E):
    # converting the set to a list
    L = list(E)
    # initialising the maximum and minimum 
    M = L[0] 
    m = L[0]
    for x in L:
        if x < m :
            m = x
    for x in L:
        if M < x:
            M = x
    return (m , M)

# Testing algorithm
E = E = {13 , 2 , 47 , 23 , 71 , 17}
print("(minimum , maximum) = " , minMax(E))
# The output is : (minimum , maximum) =  (2, 71)


Younes Derfoufi
my-courses.net

Saturday, October 10, 2020

To hyperlink to the tutorial that you have created, create a link from the page you would love to hyperlink from -Python-courses-usually the Welcome.md web page-Python-courses- using double brackets.
every educational consists of a quick explanation of the problem, and a short exercise so that you can test the person. as soon as the consumer has completed modifying the code in keeping with the exercise, it ought to execute to print out the predicted output that you will provide.
will face troubles if the value to be assigned itself includes unmarried costs.as an instance to assign the string in these bracket-Python-courses-single costs are -Python-courses- -Python-courses--Python-courses- you need to use double costs simplest like this
That prints out four, due to the fact the area of the primary occurrence of the letter -Python-courses-o-Python-courses- is four characters away from the primary man or woman. word how there are sincerely two o-Python-courses-s in the word - this technique best acknowledges the primary.
This prints a slice of the string, beginning at index three, and finishing at index 6. but why 6 and no longer 7-Python-courses- again, most programming languages do that - it makes doing math inside the ones brackets less complicated.

Exercices 200

Write a program in python as a function that determines the intersection of two sets without using any predefined functions. Example if
E = {"Java", "Python", "Javascript", "C ++", "C #"} 
#and 
F = {"VB.ET", "Java", "Kotlin", "Python"}
, the function returns the set:
{"Java", "Python"}

Solution

def set_intersect(E, F):
    # initialising the intersection of E and F
    E_inter_F = set({})
    for x in E:
        if x in F:
            E_inter_F.add(x)
    return E_inter_F

# Testing algorithm
E = {"Java", "Python", "Javascript", "C ++", "C #"}
F = {"VB.ET", "Java", "Kotlin", "Python"}
print("The intersection of E and F is : " , set_intersect(E , F))
# The output is : The intersection of E and F is :  {'Java', 'Python'}


Younes Derfoufi
my-courses.net

Friday, October 9, 2020

To hyperlink to the tutorial that you have created, create a link from the page you would love to hyperlink from -Python-courses-usually the Welcome.md web page-Python-courses- using double brackets.
every educational consists of a quick explanation of the problem, and a short exercise so that you can test the person. as soon as the consumer has completed modifying the code in keeping with the exercise, it ought to execute to print out the predicted output that you will provide.
will face troubles if the value to be assigned itself includes unmarried costs.as an instance to assign the string in these bracket-Python-courses-single costs are -Python-courses- -Python-courses--Python-courses- you need to use double costs simplest like this
That prints out four, due to the fact the area of the primary occurrence of the letter -Python-courses-o-Python-courses- is four characters away from the primary man or woman. word how there are sincerely two o-Python-courses-s in the word - this technique best acknowledges the primary.
This prints a slice of the string, beginning at index three, and finishing at index 6. but why 6 and no longer 7-Python-courses- again, most programming languages do that - it makes doing math inside the ones brackets less complicated.

1 - What is Sympy?

SymPy is a Python library for symbolic computing. It provides computer algebra functionality as a stand-alone application, as a library for other applications, or live on the web as SymPy Live or SymPy Gamma. SymPy is easy to install and inspect as it is written entirely in Python with few dependencies. SymPy includes functionalities ranging from basic symbolic arithmetic to calculus, algebra, discrete mathematics and quantum physics ... The Sympy library is able to format the result of calculations as LaTeX code.

2 - Installation of the SymPy library

to install the Sympy library, just use the pip utility with the command:
pip install sympy

3 - Identify the installed version of Sympy

To find the version of Sympy installed, just type the commands:
>>> import sympy
>>> sympy .__ version__
    '1.4'

4 - Use of Symbols

The SymPy library can be used in any environment where Python is available. In order to be able to use it, we must first import it:
>>> from sympy import *
We will see a first use of symbols. To define an x ​​symbol, we use the command:
>>> x = Symbol ('x') # note the S in uppercase
>>> x
x
To define several symbols at the same time, we use the command:
>>> x, y, z = symbols ('x y z') # note the lowercase 's'
>>> x, y, z
( X Y Z )

5 - Use of sympy expressions

A sympy expression is obtained by combining a number of symbols using functions and classical operators of addition, multiplication ...

Example

expr = 2 * sin (x) + y

Example

from sympy import *
x = symbols ('x')
expr = (x + 1) ** 7
print (expr)

#Which displays after execution:
#(x + 1) ** 7
You can also do operations on expressions. Here is an example with the expand() method
from sympy import *
x = symbols ('x')
expr = (x + 1) ** 7
print (expr.expand ())

#Which displays after execution:
#x ** 7 + 7 * x ** 6 + 21 * x ** 5 + 35 * x ** 4 + 35 * x ** 3 + 21 * x ** 2 + 7 * x + 1

Example (simplify() method)

from sympy import *
x = Symbol ('x')
expr1 = (x + 1) ** 2
expr2 = x ** 2 + 2 * x + 2
expr3 = simplify (expr2 - expr1)
print ("expr2 - expr1 =", expr3)
The output is: expr2 - expr1 = 1

Example (comparison of 2 expressios using the equals() method)

from sympy import *
x = Symbol ('x')
e1 = 2 * sin (x) * cos (x)
e2 = sin (2 * x)
print (e1.equals (e2))

#The output is : True


Younes Derfoufi
my-courses.net
C-Python-courses-python script.py -Python-courses- the Python built-in

Exercise 41

Write a Python program allowing from a given list to create a text file whose lines are the elements of this list. Example if the list is:
List_programming_books = ["Python programming books", "Java programming books", "C ++ programming books", "C # programming books"]

, the generated file will be formed by the lines:


Python programming books
Java programming books
C ++ programming books
C # programming books

Solution

import os
List_programming_books = ["Python programming books", "Java programming books", "C ++ programming books", "C # programming books"]
file = open("List_programming_books.txt" , "w")
for element in List_programming_books:
    file.write(element + "\n")
file.close()
os.startfile("List_programming_books.txt")


Younes Derfoufi
my-courses.net

Tuesday, October 6, 2020

Python-courses-python-modules

1 - About the platform module

Python provides a built-in module called platform to provide various system information. The Platform module is used to retrieve as much information as possible about the platform on which the program is currently running.This module plays a crucial role when you want to check if your program is compatible with the python version installed on a particular system. or whether the hardware specifications meet your program requirements. This module already exists in the python library and does not require installation using the pip utility. It can be imported using the following syntax:
import platform

2 - Methods associated with the platform module

2.1 - The platform.processor() method

Example: display processor informations

# import of the platform module
import platform
# display of processor information
print ('Processor:', platform.processor ())
# The output is: Processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel

2.2 - platform.platform ()

Returns a unique string identifying the underlying platform with as much useful information as possible.

Example

# import of the platform module
import platform
# display of the machine type
print ('Platform processor:', platform.platform ())
# Displays: Platform processor: Windows-7-6.1.7601-SP1

2.3 The platform.architecture() method

This function returns a tuple that stores information about the binary architecture (number of bits in the platform processor) and the binding format.

Example: display of the architecture of the machine

# import of the platform module
import platform
# display of the platform architecture
print ('Platform architecture:', platform.architecture ())
# Displays: Platform architecture: ('64bit', 'WindowsPE')

2.4 - The platform.machine() method

This function returns a string that displays the machine type, by machine type here, this means information that indicates the width or size of the registers available in the kernel.

Example: display of the machine type

# import of the platform module
import platform
# display of the machine type
print ('Machine type:', platform.machine ())
# Displays: Machine type: AMD64

2.5 - The platform.node() method

This function returns a string that displays information about the node, essentially the name of the machine within the network.

Example: display the name of the network node

# coding: utf-8
# import of the platform module
import platform
# node information
print ('Name of the node within the network:', platform.node ())
# Displays: Name of the node within the network: acer-PC

2.6 - platform.system()

This function returns a string that displays the name of the operating system on the current device used to run the program.

Example: display of the name of the operating system

# coding: utf-8
# import of the platform module
import platform
# operating system name
print ('System:', platform.system ())
# Displays: System: Windows

2.7 - The platform.platform() method

This function returns a single string containing as much useful information as possible to retrieve from the system. The output may differ from system to system.

Example: display information on the platform

# import of the platform module
import platform
# display information on the platform
print ('Platform information:', platform.platform ())
# Displays: Platform Info :: Windows-7-6.1.7601-SP1

2.8 - The platform.python_build() method

This function returns a tuple which stores information about python build date and build number. This information is stored in the tuple as a string data type.

Example: Display python version.

# coding: utf-8
# import of the platform module
import platform
# display the python build number
print ('Python build number and date:', platform.python_build())
# Displays: Python build number and date: ('tags / v3.7.2: 9a3ffc0492', 'Dec 23 2018 23:09:28')

2.9 - The platform.uname() method

Quite portable uname interface. Returns a tuple of strings (system, node, version, version, machine, processor) identifying the underlying platform. Note that unlike the os.uname() function, this also returns possible processor information as an additional tuple input.

Example

# import of the platform module
import platform
print ('Platform info:', platform.uname())
# The output is:
#Plate forme info: uname_result(system='Windows', node='acer-PC', release='7', version='6.1.7601', machine='AMD64', processor='Intel64 Family 6 Model 58 Stepping 9,GenuineIntel')

2.10 - platform.python_version ()

This function returns a string that displays the version of Python currently running on the system.

Example: Display of the python version

# Python program to display the python version
# import of the platform module
import platform
# display the python version
print ('Python version:', platform.python_version ())
# Displays: Python version: 3.7.2

2.11 - platform.python_compiler()

This method returns a string identifying the compiler used to compile Python.

Example: Displaying information from the python compiler

# import of the platform module
import platform
# display of the python compiler
print ('Python compiler:', platform.python_compiler ())
# Displays: Python compiler: MSC v.1916 64 bit (AMD64)

2.12 - The platform.python_branch() method

This function returns a string displaying information about the python SCM branch, SCM stands for Source Code Manager, it is a tool used by programmers to manage source code. SCM is used to track software revisions.

Example: Display of python SCM information

# Python program to display python SCM information
# import of the platform module
import platform
# display of python SCM information
print ('Python MSC:', platform.python_compiler ())
# Displays: Python SCM: MSC v.1916 64 bit (AMD64)

2.13 - The platform.python_implementation() method

This function returns a string that displays information about the python implementation. The possible outputs of this function are CPython, JPython, PyPy, IronPython.

Example: Viewing the python implementation

# coding: utf-8
# Python program to show the python implementation
# import of the platform module
import platform
# display the python implementation
print ('Python implementation:', platform.python_implementation ())
# Displays: Python implementation: CPython


Younes Derfoufi
my-courses.net
Python-courses-python-exercises-python-remainder-in-euclidean-division

Exercise 764

Write a python algorithm as function which takes as parameter an integer n and which returns the remainder in the Euclidean division by n of the sum of the first n integers Sn = 1 + 2 + 3 + ... + n.

Solution

# creating a function which calculates the sum of n first integer Sn = 1 + 2 + 3 + ... + n for a given integer n.
def sumFirst(n):
    # Initializing the sum of first integer  Sn = 1 + 2 + 3 + ... + n
    s = 0
    
    for i in range(1 , n + 1):
        s = s + i
    
    return s
# creating a function that calculate the remainder in the Euclidean division by n of the sum Sn = 1 + 2 + 3 + ... + n
def remainder_n(n):
    # getting the sum Sn = 1 + 2 + 3 + ... + n
    Sn = sumFirst(n)
    # the searched remainder is
    rm = Sn%n
    return rm
    
# Testing algorithm for n = 24
print('The remainder in eucliean division of Sn by n is   : ' , remainder_n(4)) # Sn = 1 + 2 + 3 + 4 = 10 , then Sn%4 = 2
# The output is : The remainder in eucliean division of Sn by n is   :  2


Younes Derfoufi
my-courses.net
Reserved words python-courses-python-tutorial-Python-courses-python-exercises

Exercise 763

Write a python algorithm as function which take as argument an integer n and return the list of all tuples (p , q) of positive integers p and q shch that the Euclidean division of p by q gives 3 as the quotient and 2 as the remainder.

Solution

def listTuples(n):
    # Initializing the list of all tuples (p,q)
    listTup = []
    
    for i in range(1 , n + 1):
        for j in range(1 , i + 1):
            if (i%j == 2 and i//j == 3):
                listTup.append((i,j))
    
    return listTup
# Testing algorithm for n = 24
print('The list of all tuples (p,q) is  : ' , listTuples(24))
# The output is : The list of all tuples (p,q) is  :  [(11, 3), (14, 4), (17, 5), (20, 6), (23, 7)]


Younes Derfoufi
my-courses.net

Sunday, October 4, 2020

python-tutorial-Python-courses-python-exercises-sum-divisors-for-given-integer

Exercise 762

Write a Python program as a function which takes an integer n as a parameter and which returns the sum of all divisors of n

Solution

def sumDivisors(n):
    # Initializing the sum of all divisors of n
    sumDiv = 0
    for i in range(1 , n + 1):
        if n%i == 0:
            sumDiv = sumDiv + i
    return sumDiv
# Testing algorithm for n = 6 sumdivisors(6) = 1 +2 + 3 + 6 = 12
print('The sum of all divisors of 6 is : ' , sumDivisors(6))
# The output is : The sum of all divisors of 6 is :  12


Younes Derfoufi
my-courses.net

python-courses-python-exercises-python-tutorials-python-formation

study Python Offline is a an easy to apply, person-pleasant platform to examine Python. Get commenced in Python with precise and to the point Python tutorials which can be easy to comprehend and apprehend. it's far a full bundle for Python programming. Its consists of tutorials to research, mcqs to check your knowledge, coding questions to improve your logic and get used to the Python style of coding and closing however not the least a light-weight Interpreter so you can practice Python programming as you analyze. This app no longer only makes a speciality of coding, but also helps to strengthen your common sense with the aid of going via facts systems and algorithms and the way these facts structures are applied You learn from basic concepts to extra enhance principles. i.e. algorithms and information systems the use of Python programming research Python Offline- tutorial and Programming presents a completely unique coding ground for you, where you can check your personal coding abilties as you examine Python is a fashionable-motive programming language that is turning into ever greater famous for the information science.This course focuses on python specifically for simple to advance. In our advent to python course,you'll study the powerful approaches to shop and manipulate statistics, and beneficial records science tools to start engaging in yours very own analyses. whether you are an skilled programmer or no longer, this direction is intended for all people who needs to study the Python programming language.study python programming tutorials one of the first-rate supply to learn.high-quality task for the students.lot of operating approximately coding and concept of programs.hard working daily at the cease you're making your self strong. solution lot of algorithm for studying.As for the first language .It layout for the student who want to make itself developer for gaming and other software .It very use full for it.
Lot of set of rules and lot of applications and additionally strategies to understanding to increase yourself as a developer.

the academic lessons are divided into comprehensive sections for fast and clean gaining knowledge of.
No previous programming revel in is needed

- learn ideas of Python and basic data strucutres
- increase information systems
- exercise with offline Python interpreter
- 250+ MCQs with targeted rationalization
- Many styles of Python packages with output
- often updated conceptual Python questions

content material is up to date regularly and when you have any remarks or any characteristic request, simply mail us and we will be glad to assist
come to be the coder you continually wanted to be with "research Python offline" and learn how to code in days.

subjects covered:

Variables and types
Lists
Shallow and Deep copy
Operators
international and neighborhood Variable
String Formatting
simple String Operations
conditions
Loops
features
Recursive capabilities
Decorators
training and objects
Dictionaries
Modules

statistics systems and Algorithms
Linear search
Binary search
Bubble sort
choice sort
Insertion kind
Shell sort
Stack
Queue
trees
timber representation
timber Traversals
Graphs
Graphs representation
Graphs Traversals





my-courses.net
python-courses-python-exercises-python-tutorials-python-formation
Our python programming educational gives the quality take a look at substances for all the novice level coders who want to research the python programming language and need to construct sturdy basics to crack any job interview on this language.
We made this app via consulting experienced professionals from the sphere of Python language. With the growing call for in this discipline , we decided to provide loose studying have a look at materials mainly designed for faculty and university students.
there is no want of net as this app is available offline and also you just need to install it and that is it all required to get began .
Python is a trendy-cause programming language this is turning into ever extra famous for the statistics technology.This course specializes in python specifically for simple to advance.
In our creation to python direction,you'll find out about the powerful approaches to keep and manage statistics, and beneficial information technology tools to begin undertaking yours very own analyses.

whether or not you are an experienced programmer or not, this direction is meant for everybody who wishes to examine the Python programming language.study python programming tutorials one of the first-class supply to study.fantastic challenge for the students.lot of operating about coding and idea of applications.hard running each day at the stop you are making your self sturdy.
This programming app consists of well defined fundamentals and simple required to understand and research Python programming language.

all of the topics in python are defined with right element, so that both intermediate and amateur stage coders can understand the whole lot without any confusion.

50+ python programming questions with technique to decorate the depth of knowledge of this coding language.

regularly asked interview questions with right explanation to make you interview ready.

preceding 12 months CBSE board query paper with solution

capabilities :
- topic sensible Python programming notes
- packages for better expertise (50+ applications)
- Output for each software
- preceding 12 months CBSE questions with solutions
- quite simple user Interface
- frequently asked interview questions
- NO advertising!
- Compiler to exercise programming

As we all recognize that an artwork is specialised by way of working towards. in addition we've got online compiler to practice python programming to make the studying better.

Our app enables you to carry Python programming Tutorials in your android phone. It incorporates about a hundred applications, many FAQ's & crucial exam Questions and interview requested questions.
This app have a totally simple and attractive user interface and the all the contents discussed in our Python app can be without difficulty understood by means of the customers(beginners in addition to experts). this is your one step destination to study from a number of the quality coders of our agency.



my-courses.net
python-courses-python-exercises-python-tutorials-python-formation

nowadays python is most popular and stressful programming language. So if you are locating some thing to learn it you then are at proper region. Examples of solutions of sports and exercise troubles within the Python programming language, including acknowledged algorithms (binary search, Euclidean algorithm, sieve of Eratosthenes, factorial calculation, Fibonacci collection, locating the greatest commonplace divisor and the least not unusual more than one). a few examples incorporate distinctive comments. Our Python tutorials will train you primary in addition to boost python with fine practices. those cloth supports brand new Python three.5+ version . # what is python programming ? - Python is a popular-reason interpreted, interactive, object-oriented, and high-stage programming language. # Why this app best for you ? - here regardless of whether or not you are a amateur or an improve learner of python, we have written those tutorials for all kind of learners. - in case you are very new in programming international then additionally you could use this app. # What are the stuff are you getting right here ? - at the same time as studying coding we need to go primary to develop rout. So right here we've accompanied equal factor while scripting this tutorials. initially you'll examine a few basic things of python then this app will take you to boost stage of python. - Out materials are divided in five sections 1. basic Python 2. develop Python three. Python practice Examples 4. FAQ : regularly requested questions about python 5. Python Interview Questions # What you get inside these sections ? 1. simple Python - right here you will examine primary stuff of python programming. getting to know fundamental is maximum critical a part of any programming due to the fact this could decide how a lot properly grip you will get on programming. - we've got divided this phase in five parts. -> Python key phrases -> simple subjects of python -> OOPs : item orientated programming idea of python -> Python built in capabilities - String features - listing functions - Dictionary functions - Tuple capabilities - Set capabilities - file features -> JSON with python 2. improve Python - Now right here you'll circulate to next of python programming. here maximum of the things you will analyze of enterprise stage. stuff you need to recognise before going to job interview can be included on this phase. - we have decided this phase in four parts -> enhance Python subjects -> study Database with Python - MySQL with Python - MongoDB with Python - Sqlite with Python - PostgreSQL with Python -> Python GUI with TKinter -> Python Libraries - study Python Numpy - learn Django - research Flask 3. Python exercise Examples - exercise is maximum vital component to be accurate at programming. all of us recognize practice makes perfect. Leaning new ability no longer a massive deal however hold training that skill is a massive deal. So here we focused extra on practice section. - right here you may get greater than 500 python programming examples. - we have divided these examples by means of python subject matter smart. -> basic Python applications element -> fundamental Python programs element -> Array programs -> Conditional assertion programs -> sample applications -> functions packages -> Math programs -> Date and Time packages -> list applications -> String applications -> Dictionary programs -> Set packages -> Recursion programs -> with out Recursion applications -> Tuple programs -> document handling applications -> OOPs programs -> search and type programs -> Sqlite programs -> JSON programs -> Collections programs -> Lambda function applications -> OS packages four. FAQ (often asked questions) about python - right here we stated all of the query which have been asked with the aid of python learners with distinctive answer. five. Interview Questions and solutions Of Python - This app will app will provide all the interview questions with solutions which are generally asked in python activity interview. - This segment is split in five parts -> primary and develop Python Interview Questions -> GUI : TKinter interview Questions -> Numpy Interview Questions -> Django Interview Questions -> Pandas interview Questions 6. Python Code Compiler - here you may run your python code # capabilities of APP - Code replica - Day and night time mode - highlight remaining visited page



Younes Derfoufi
my-courses.net

Saturday, October 3, 2020

python-courses-python-exercises-python-tutorials-python-formation 

Learn Python: Programiz is a loose Android app that makes it clean to analyze and run Python. you can use the app to observe via Python tutorials step-by-step, test with Python code in each lesson, take quizzes and greater to research simple ideas of Python three from beginning to superior. The study Python app calls for no previous coding understanding, and perfect for novices who need to research Python programming. if you do not recognise, Python is a effective programming language that has many programs. it is also a first-rate language to begin getting to know to program because Python code is less difficult to write and apprehend. The app makes coding more interesting by means of offering dozens of sensible examples to be able to practice that you could edit and run in our Python interpreter. Our python programming tutorial affords the great have a look at substances for all the amateur stage coders who need to learn the python programming language and need to construct sturdy basics to crack any activity interview in this language. Write Python code at once for your Android device! This app helps the latest Python three syntax and is ideal for getting to know and checking out code snippets!

Python is an interpreted, high-level, trendy-cause programming language. Created by means of Guido van Rossum and primary launched in 1991, Python's layout philosophy emphasizes code readability with its awesome use of massive whitespace. Its language constructs and object-orientated technique aim to assist programmers write clean, logical code for small and big-scale initiatives. We made this app by using consulting skilled experts from the sphere of Python language. With the developing demand on this discipline , we determined to offer loose gaining knowledge of observe materials in particular designed for faculty and college students. there's no want of internet as this app is available offline and you just want to put in it and that is it all required to get started . analyze Python free Mode Get all the direction content and examples without cost. • Programming principles divided into thoughtfully curated chunk-sized lessons which can be simpler to apprehend for novices • Python quizzes to revise what you have got discovered with feedback • A powerful Python code editor with Python shell that allows you to put in writing and run code • tons of practical Python examples to practice what you have got discovered • Bookmark subjects that you locate difficult and revisit them each time if you want help • song your progress and retain from in which you have got left study Python seasoned: For Seamless mastering experience Get get entry to to all pro features for a nominal month-to-month or annual fee: • ad-free experience. learn without distraction by getting rid of all commercials • limitless code runs. Write, edit and run code as generally as you need in our code editor • darkish mode. lessen eye pressure and keep battery at the identical time • break the rule. comply with the classes in any order you need • Get certified. get hold of a certificate while you whole the Python course Why learn Python App From Programiz? • App created after thoughtfully assessing comments from loads of programming novices • Step-by using-step tutorials further divided into chew-sized lessons so that coding is not overwhelming • A arms-on technique to gaining knowledge of; start writing Python packages from the first actual day study Python 3 on the move. Get commenced Python programming nowadays! we like to hear from you. inform us approximately your experience at app@programiz.com. go to internet site: Programiz development group: Truenary answers



my-courses.net
python-tutorial-Python-courses-python-exercises-convert-dictionary-to-html-table

Exercise 120

Write a python program that transforms a dictionary into an html table and saves the content to an html file called 'convert_dictionary.html'. Example for the dictionary:
name_email = {'david': 'david@gmail.com', 'hafid': 'hafid@gmail.com', 'nathalie': 'nathalie@gmail.com', 'najib': 'najib @ gmail.com '}

the program should create an html file that displays the content in an html table: 

Solution

import os
name_email = {'david' : 'david@gmail.com' ,  'hafid' : 'hafid@gmail.com' ,  'nathalie' : 'nathalie@gmail.com' , 'najib' : 'najib@gmail.com' }

htmlContent = """

"""
for key , value in name_email.items():
    htmlContent = htmlContent + "".format(key , value)
htmlContent = htmlContent + "
Name Email
{} {}
" file = open("convert_dictionary.html" , 'w') file.write(htmlContent) file.close() os.startfile("convert_dictionary.html")


Younes Derfoufi
my-courses.net

Friday, October 2, 2020

Learn Python - AI with Python, Django, Flask, ML - learn Python three Tutorials built-innerintegrated to superior, you may research,
guide to built-in Python
Python three entire guide
Interview query for Python developers
item oriented Python
Concurrency integrated Python
Requests Python
TurboGears Python framework
beautiful Soup tutorials
guide for BioPython
analyzeintegrated Jython
Numpy Tutorials
built-in Theano
WxPython entire manual
Bokeh tutorials

built-ine Django framework unfastened
Flask entire guide
manual for built-in CherryPy
Apache Spark tutorials

Category Of Mobile Courses

Actualités (644) Adsense (1) Affiliation (1) Algebraic Topology (2) Algorithmic (1) all-news (30) Android (5) Android App (8) Android app without code (4) Android Apps (189) Android Development (4) Android download (2) Android OS (3) AngularJS (1) Automata theory and formal language (5) C programming (5) Category and Functor (8) CMS (3) Computer Glossary (18) Create Mobile App With Ionic Framework (2) CSS (2) CSS-Cascading-Style-Sheets (4) Developpement Java (13) Differential Geometry (1) Django-Python-Framework (8) dropshiping (26) Earn Money by Internet (4) Emplois (23) Framework php (2) Fraud (2) HTML (7) Java For Beginners (10) Javascript (12) Kotlin Programming Language (8) Kotlin For Mobile Android (1) Linux Download (2) Marketing (5) Mobile (3) Mobile Courses (4) Mobile Marketing (4) MoneyGram (1) News (721) Node.js (5) Open Source (1) Photoshop (1) Protect Computer (1) Python (35) Python BeautifulSoup (1) Python For Data Science (2) Python-Books (6) Python-DVD-Training (1) Python-Exercises (165) Python-Framework (1) Python-IDE (1) Python-Modules (1) Python-pdf (2) Python-pyQt (1) Référencement (2) Script PHP (2) Security (6) SEO (1) Snipping Tool: Faq (1) Social Networks (1) Source Code (1) Statistics With SPSS (2) Surveillance Software (1) Travail à domicile (6) Tutoriels php en vidéos (2) Tutoriels-MySql (6) tutoriels-php (19) Utilitaires (1) VPS (1) Web Hosting (1) Webcam (1) Webmarketing (11) Western Union (1) Windows 10 (1) Windows 7 (4) Windows 7 Faq (2) Windows 8 (1) Windows Accessories (1) Windows Download (8) Windows Drivers (1) Windows Fonts (1) Windows Power Shell (2) Windows Registry (2) Windows Security (18) Windows Software (2) Windows Spyware (2) Windows utilities (3) Windows Virus (2) Windows Vista (3) Windows Wireless (1) Windows xp (1) Wordpress (1)
 

Sample text

Sample Text

 
Blogger Templates