Jovian
⭐️
Sign In
In [1]:
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
In [3]:
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
In [8]:
import math as mas
print(int(mas.pow(2,3)))
8
In [9]:
a=[1,3,5,6,7]
for i in a:
    print(i)
1 3 5 6 7
In [10]:
for i in "something":
    print(i)
s o m e t h i n g
In [16]:
stg=input("Enter a name")
str=""
for i in stg:
    str=i+str
print(str)
    
Enter a namesomething gnihtemos
In [24]:
n=int(input("enter a number"))
sum=0
for i in range(1,n+1):
    if(i%2==0):
        sum=sum+pow(i,3)
    else:
        sum=sum+pow(i,2)
print("The sum of the series is:",sum)
        
       
enter a number2 The sum of the series is: 9
In [32]:
a=[2,3,4,5]
odd=0
even=0
count=1
for i in a:
    if count%2!=0:
        odd=odd+i
    else:
        even=even+i
    count=count+1
print("sum of even nos:",even)
print("sum of odd nos:",odd)
    
sum of even nos: 6 sum of odd nos: 8
In [33]:
import jovian

In [ ]:
jovian.commit()
[jovian] Saving notebook..
In [ ]: