0% found this document useful (0 votes)
38 views2 pages

Python Basics: Keywords and Classes

The document contains Python code snippets demonstrating the use of keywords, variable assignments, and class definitions. It includes an example of a 'complexnumber' class with methods to initialize and display complex numbers. Additionally, there is an incomplete function definition for calculating the greatest common divisor (gcd) and some unrelated text fragments.

Uploaded by

Shubham Sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Python Basics: Keywords and Classes

The document contains Python code snippets demonstrating the use of keywords, variable assignments, and class definitions. It includes an example of a 'complexnumber' class with methods to initialize and display complex numbers. Additionally, there is an incomplete function definition for calculating the greatest common divisor (gcd) and some unrelated text fragments.

Uploaded by

Shubham Sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

In [ ]:

import keyword

In [3]:

print([Link])

['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif
', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda',
'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']

In [8]:
a = 1,2,3

In [12]:

a,b,_ = 1,2,3

In [14]:

a=b=c=3

In [16]:
b =2

In [ ]:

In [10]:
class complexnumber:
def __init__(self,i,j):
[Link] = i
[Link] = j
def get(self):
print([Link],'i',[Link])

In [11]:

a = complexnumber(2,3)
[Link]()

2 i 3

In [113]:

del [Link]

---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-113-cf31b1b6df5a> in <module>()
----> 1 del [Link]

NameError: name 'a' is not defined

In [ ]:
def gcd(a,b):
introduction to python

python is a

ptrt

mkldfg
In [ ]:

You might also like