Interview Preparation Python-Part1

The first line of output is the statement present in first_module.py,and the second line of O/P comes from second_module.py.In which the value of __name__ is main.
The first line of output is the statement present in first_module.py, and the second line of O/P comes from second_module.py, In which the value of __name__ is main.
O/P
round1 = ['chuck norris', 'bruce lee', 'sonny chiba']round2 = round1.copy()round2.remove('sonny chiba')print(round1) #=> ['chuck norris', 'bruce lee', 'sonny chiba']print(round2) #=> ['chuck norris', 'bruce lee']
li = [10,1,9,2,8,3,7,4,6,5]li.sort(reverse=True)
To modify global variables we need to use global keyword
We can use any keyword instead of self, in this case I have used abc instead of self

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store