0% found this document useful (0 votes)
4 views6 pages

Codes

The document contains a Python script that collects student information, performs mathematical calculations, counts vowels in a string, manages lists and dictionaries, converts binary to decimal, analyzes string characteristics, and processes tuples. It includes user inputs for various tasks and outputs results such as sums, means, and palindrome checks. The script demonstrates basic programming concepts like loops, conditionals, and data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Codes

The document contains a Python script that collects student information, performs mathematical calculations, counts vowels in a string, manages lists and dictionaries, converts binary to decimal, analyzes string characteristics, and processes tuples. It includes user inputs for various tasks and outputs results such as sums, means, and palindrome checks. The script demonstrates basic programming concepts like loops, conditionals, and data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

n=int(input("Enter the number of students you want to enter:"))

e=[]

c=[]

a=[]

for i in range(1,n+1):

print("Enter name",i,":")

x=input("name:")

print("Enter class of ",x,":")

y=input("class:")

print("Enter age of ",x,":")

z=input("age:")

e.append(x)

c.append(y)

a.append(z)

print("name","class","age",sep='\t')

for v in range(n):

print(e[v],c[v],a[v],sep='\t',end='\n')

print('\n',"Printed in separate lines:")

print('\n',"name:",end="\t")

for t in e:

print(t,end="\t")

print('\n',"class:",end="\t")

for b in c:

print(b,end="\t")

print('\n',"age:",end="\t")

for q in a:

print(q,end="\t")

x=int(input("x"))

n=int(input("n"))

l=0

for i in range(1,n+1):
k=1

for r in range(1,i+1):

k*=r

if (i%2) !=0:

l=l+((x)**(i-1))/k

else:

l=l-((x)**(i-1))/k

print(l)

x = input("Enter any string: ")

x=list(x)

vowels='a,e,i,o,u,A,E,I,O,U'

i =0

count=0

for i in range(len(x)):

for vowel in vowels:

if x[i] == vowel:

count+=1

print("The number of vowels in the string is:",count)

l=[]

n=int(input("Enter the number of elements you want in the list:"))

for i in range(n):

x=input("enter value:")

l.append(x)

print(l)

for u in l:
if l.count(u) > 1:

l.remove(u)

l.sort()

print(l)

n= int(input("enter number of values you want:"))

d={}

for i in range (n):

x = input("enter key:")

y = int(input("enter value:"))

d[x]=y

print("the dictionary before editing")

print(d)

z={}

for j in d:

print("enter key to change key to:")

x=input("key:")

z[x]=d[j]

print("the dictionary after editing")

print(z)

n= input("enter binary number:")

x=str(n)

h=0

l=len(x)-1

for i in range(len(x)):

y= x[i]

y=int(y)

h= h + (2**l)*y

l-=1

print("The decimal equivalent is:",h)

x = input('enter str: ')


a = len(x)

b=c=d=e=0

for i in x:

if i.isalpha():

b += 1

elif i.isdigit():

c += 1

elif i.isspace():

e += 1

else:

d += 1

print('no. of characters: ', a)

print('no. of alphabets: ', b)

print(' no. of digits: ', c)

print('no. of space: ', e)

print('spl. charachters: ', d)

t=()

n=int(input("enter the number of the values:"))

for i in range(n):

y=int(input("enter value:"))

t+=(y,)

print(t)

s=0

for x in t:

x=int(x)

s+=x

print("The sum is:",s)

print("The mean is:",s/n)

print("The difference between the maximum and minimum value in tuple:",max(t)-min(t))

l=[]
q=0

for j in t:

if t.count(j)>1:

l.append(j)

q+=0.5

for p in l:

if l.count(p)>1:

l.remove(p)

print("There are",q,"values repeating and these are:","\n",l)

x=input("enter any string:")

i=0

l=len(x)-1

while i < l:

if x[i]==x[l]:

i+=1

l-=1

else:

print("the string is not palindrome")

print("the string is palindrome")

x=int(input("enter the number of the students:"))

t=()

z=()

y=()

for i in range(x):

n=input("enter the email id the of the student:")

t+=(n,)

z+=(n.split("@")[0],)

y+=(n.split("@")[1],)
print("email id's=",t)

print("username=",z)

print("domain name=",y)

You might also like