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

Python Programs

The document contains Python code snippets demonstrating basic operations such as arithmetic, list iteration, and class definitions. It defines a 'student' class with attributes and methods to display student details. Additionally, it includes commands for setting up a Django project.

Uploaded by

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

Python Programs

The document contains Python code snippets demonstrating basic operations such as arithmetic, list iteration, and class definitions. It defines a 'student' class with attributes and methods to display student details. Additionally, it includes commands for setting up a Django project.

Uploaded by

dtfuvihyv6b
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

a=1

>>> b=2
>>> c=a+b
>>> c

1) lst =[10,20,4,5,8]
def display(lst):
for item in lst:
print(item)

display (lst)

/////student details
class student:
college ='siddartha'
def __init__(self,name,ids,fees):
self.name=name
self.ids=ids
self.fees=fees

def studying(self):
print('my name is {}' .format(self.name))
print('ids is{}'.format(self.ids))
print('fees is{}'.format(self.fees))
object=student('mayank',200,1000)
object.studying()
print(object.college)

///emoploy program

class student:
college ='siddartha'
def __init__(self,name,ids,fees):
self.name=name
self.ids=ids
self.fees=fees

def studying(self):
print(student.college)
print('my name is {}' .format(self.name))
print('ids is{}'.format(self.ids))
print('fees is{}'.format(self.fees))
object=student('mayank',200,1000)
#object2=student('salman',300,2000)
object.studying()
#print(object.college)

////commands
django-admin
django-admin startproject project1
cd project1
>cd..
python manage.py startapp demopapp

You might also like