DSL 4
DSL 4
A = []
a=int(input("Enter no. of present students : "))
for i in range (a):
pre =int(input("Enter roll no. of present students : "))
A.append(pre)
print("Present Students are : ",A)
b=int(input("Enter roll no. you want to search : "))
if b not in A:
print("Absent")
else:
print("Present")
Output:
Enter no. of present students : 2
Enter roll no. of present students : 1
Enter roll no. of present students : 2
Present Students are : [1, 2,]
Enter roll no. you want to search : 7
Absent
Output:
Enter no. of present students : 2
Enter roll no. of present students : 1
Enter roll no. of present students : 2
Present Students are : [1, 2]
Enter roll no. you want to search : 2
Present