Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Assignment 2/180501052/attendanceStudents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
l=[]
x=int(input("Enter no of student"))
print("Enter your string")
for i in range(0,x):
a=str(input())
l.append(a)
print("The students present were:")
for j in l:
z="P" in j
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a flaw in your logic here. Checking if 'P' is in the string will lead to marking people with 'P' in their names present, even when they are absent. Think of the following test case:
Priya-A

Your code will mark Priya as present even when absent. Correct the code, commit the changes and comment acknowledging the same.

if(z):
print(j[0:-2],end=" ")
11 changes: 11 additions & 0 deletions Assignment 2/180501052/occurances.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
x =str(input("Enter the String:"))
a = {}

for i in x:
if i in a:
a[i] += 1
else:
a[i] = 1
print("Occurences")
for j,y in a.items():
print(j,y)
7 changes: 7 additions & 0 deletions Assignment 2/180501052/robberThief.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
x =int(input("Enter the amount robbed by the thief:"))
if x < 5000:
print("Loss")
if x > 19999:
print("Good")
if x>4999 and x<20000:
print("Moderate")