Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
class something():
def __init__(self,name,email):
self.name=name
self.email=email
li=[]
for i in range(1,3):
obj=something(input("Enter a name"),input("Enter a number"))
li.append(obj)
for j in li:
print("the name is:",j.name)
print("The email is:",j.email)
Enter a namesome
Enter a number9090909090
Enter a nameshiv
Enter a number1234567890
the name is: some
The email is: 9090909090
the name is: shiv
The email is: 1234567890
class student():
def __init__ (self,name,phone,branch):
self.name=name
self.phone=phone
self.branch=branch
li=[]
for i in range(1,6):
obj=student(input("enter the name:"),int(input("enter the phn no:")),input("enter the branch"))
li.append(obj)
for j in li:
print("the name is:",j.name)
print("phone no is",j.phone)
print("branch is",j.branch)
enter the name:atul
enter the phn no:9866
enter the branchmca
enter the name:ram
enter the phn no:89696986986
enter the branchmca
enter the name:shyam
enter the phn no:8976685
enter the branchmca
enter the name:siv
enter the phn no:86550876
enter the branchmca
enter the name:bhim
enter the phn no:085855807
enter the branchmca
the name is: atul
phone no is 9866
branch is mca
the name is: ram
phone no is 89696986986
branch is mca
the name is: shyam
phone no is 8976685
branch is mca
the name is: siv
phone no is 86550876
branch is mca
the name is: bhim
phone no is 85855807
branch is mca
import math as mas
print(int(mas.pow(2,3)))
8
a=[1,3,5,6,7]
for i in a:
print(i)
1
3
5
6
7
for i in "something":
print(i)
s
o
m
e
t
h
i
n
g