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

Leave a Reply