#student structure
import sys
class student:
rno = 0
sname = ""
tot = 0
x = student()
x.rno = int(raw_input("\nEnter roll number, name and total marks"))
x.sname = raw_input("")
x.tot = int(raw_input(""))
sys.stdout.write("\n\tDetails entered are \n")
sys.stdout.write("\nRoll No. : %d"%(x.rno))
sys.stdout.write("\nStudent Name : %s"%(x.sname))
sys.stdout.write("\nTotal marks : %d"%(x.tot))
sys.stdout.write("\n\nPress any key to continue...")
import sys
class student:
rno = 0
sname = ""
tot = 0
ch = 'y'
std = [student() for i in range(0,50)]
n = int(raw_input("\nHow many students ? "))
for i in range(0,n):
std[i].rno = int(raw_input("\nRoll Number ? "))
std[i].sname = raw_input("\nName ? ")
std[i].tot = int(raw_input("\nTotal marks ? "))
while ch == 'y' or ch == 'Y':
temp = int(raw_input("\nEnter student roll number to display marks : "))
flag = 0
for i in range(0,n):
if flag == 0:
if std[i].rno == temp:
sys.stdout.write("\nMarks obtained by %d %s"%(std[i].rno,std[i].sname))
sys.stdout.write("\nTotal : %d"%(std[i].tot))
flag = 1
if flag == 0 :
sys.stdout.write("\n%d is not present in the list"%(temp))
ch = raw_input("\npress y - to continue \n any other key to stop.")
import sys
class student:
rno = 0
sname = ""
tot = 0
std = [student() for i in range(0,50)]
n = int(raw_input("\nHow many students ? "))
for i in range(0,n):
std[i].rno = int(raw_input("\nRoll Number ? "))
std[i].sname = raw_input("\nName ? ")
std[i].tot = int(raw_input("\nTotal marks ? "))
print "\n-------------------------------------------------------"
print "\n Roll No. Name Total Marks"
print "\n-------------------------------------------------------"
for i in range(0,n):
if std[i].tot >= 75:
sys.stdout.write("\n %-8d %-20s %5d"%(std[i].rno,std[i].sname,std[i].tot))
print "\n-------------------------------------------------------"
import sys
class employee:
eno = 0
ename = ""
epay = 0
jdate = ""
def revise(temp):
if temp <= 2000:
return (temp + (temp*0.15))
else:
if temp <= 5000:
return (temp + (temp * 0.10))
else:
return temp
employs = [employee() for i in range(0,25)]
i = 0
ch = 'y'
while ch.upper() == 'Y':
employs[i].eno = int(raw_input("\nEmployee No.? "))
employs[i].ename = raw_input("\nName ? ")
employs[i].epay = int(raw_input("\nExisting pay? "))
employs[i].jdate = raw_input("\nJoining Date ? ")
i += 1
ch = raw_input("\nPress y - to continue any other key to stop.")
n = i
sys.stdout.write("\n\n%d records are entered"%(n))
sys.stdout.write("\nPress any key to print the revised salary list")
for i in range(0,n):
employs[i].epay = revise(employs[i].epay)
print "\n Employees Revised Pay List"
print "\n----------------------------------------------------------------------------------"
print "\n S.No Number Name Joinint date Pay"
print "\n----------------------------------------------------------------------------------"
for i in range(0,n):
sys.stdout.write("\n %-4d %-d %-15s %10s %-8d"%(i+1,employs[i].eno,employs[i].ename,employs[i].jdate,employs[i].epay))
print "\n----------------------------------------------------------------------------------"
import sys
class cricket:
pname = ""
tname = ""
bavg = 0
probable = [cricket() for i in range(0,30)]
n = int(raw_input("\nHow many players ? "))
for i in range(0,n):
probable[i].pname = raw_input("\nPlayer name ? ")
probable[i].tname = raw_input("\nWhich team ? ")
probable[i].bavg = int(raw_input("\nBatting average ? "))
j = 0
teams = ['' for i in range(0,20)]
teams[j] = probable[0].tname
j += 1
i = 1
for i in range(1,n):
flag = 0
k = 0
while k < j and flag == 0:
if probable[i].tname == teams[k]:
flag = 1
k += 1
if flag == 0:
teams[j] = probable[i].tname
j += 1
i += 1
for k in range(0,j):
sys.stdout.write("\n\t%s"%(teams[k]))
print "\n-------------------------------------------------------"
for i in range(0,n):
if probable[i].tname == teams[k]:
sys.stdout.write("\n %-15s %6d"%(probable[i].pname,probable[i].bavg))
print "\n-------------------------------------------------------"
import sys
class student:
roll_no = 0
sname = ""
marks = 0
std = [student() for i in range(0,10)]
print "\n-----------------------------------------------------------------------"
print "\n Main Menu"
print "\n-----------------------------------------------------------------------"
print "\nPress 1 to enter roll numbers"
print "\n 2 to enter names"
print "\n 3 to enter marks"
print "\n 4 to stop"
ch = int(raw_input("\nEnter your choice : "))
if ch < 4:
n = int(raw_input("How many students ? "))
for i in range(0,n):
if ch == 1:
std[i].roll_no = int(raw_input("\nRoll number ? "))
else:
if ch == 2:
std[i].sname = raw_input("\nStudent name ? ")
else:
if ch == 3:
std[i].marks = int(raw_input("\nAverage marks ? "))
if ch == 1:
print "\n-------------------------------------------------------------------"
print "\n Students roll number list"
print "\n-------------------------------------------------------------------"
for i in range(0,n):
sys.stdout.write("\n\t%d"%(std[i].roll_no))
print "\n-------------------------------------------------------------------"
else:
if ch == 2:
print "\n-------------------------------------------------------------------"
print "\n Students name list"
print "\n-------------------------------------------------------------------"
for i in range(0,n):
sys.stdout.write("\n\t%s"%(std[i].sname))
print "\n-------------------------------------------------------------------"
else:
if ch == 3:
print "\n-------------------------------------------------------------------"
print "\n Students mark list"
print "\n-------------------------------------------------------------------"
for i in range(0,n):
sys.stdout.write("\n\t%d"%(std[i].marks))
print "\n-------------------------------------------------------------------"