python programming middle level topics
Answers
Please see the attachment open link in it and solve your doubts it is a very helpful webpage.
Explanation:
After going through the basics of python, you would be interested to know more about further and bit more advance topics of the Python3 programming language.
This article covers them.
Please remember that Python completely works on indentation and it is advised to practice it a bit by running some programs. Use the tab key to provide indentation to your code.
This article is divided in following five sections:
Classes
Just like every other Object Oriented Programming language Python supports classes. Let’s look at some points on Python classes.
Classes are created by keyword class.
Attributes are the variables that belong to class.
Attributes are always public and can be accessed using dot (.) operator. Eg.: Myclass.Myattribute
A sample E.g for classes:
# creates a class named MyClass
class MyClass:
# assign the values to the MyClass attributes
number = 0
name = "noname"
def Main():
# Creating an object of the MyClass.
# Here, 'me' is the object
me = MyClass()
# Accessing the attributes of MyClass
# using the dot(.) operator
me.number = 1337
me.name = "Harssh"
# str is an build-in function that
# creates an string
print(me.name + " " + str(me.number))
# telling python that there is main in the program.
if __name__=='__main__':
Main()