Skip to main content

The Fundamentals of Digital Marketing Certification

The Fundamentals of Digital Marketing Certification
Trying to make use of some spare time during these endless lockdowns. I completed The Fundamentals of Digital Marketing course on Google Digital Garage and got certified. This is not a great victory, nevertheless, I celebrate every small step towards a greater goal. #googlegarage #fundamentalsofdigitalmarketing #digitalmarketing

FDS 2

 Practical No: -2

Experiment No. 2: Write a Python program to store marks scored in subject “Fundamentals of Data

Structure” by n students in the class. Write function to compute following:

a) The average score of class

b) Highest score and lowest score of class

c) Count of students who were absent for the test

d) Display mark with highest frequency

Code:

# Function for average score of the class

def average(listofmarks):

 sum=0

 count=0

 for i in range(len(listofmarks)):

 if listofmarks[i]!=-999:

 sum+=listofmarks[i]

 count+=1

 avg=sum/count

 print("Total Marks : ", sum)

 print("Average Marks : {:.2f}".format(avg))

#<----------------------------------------------------------------------------------------------------->

# Function for Highest score in the test for the class

def Maximum(listofmarks):

 for i in range(len(listofmarks)):

 if listofmarks[i]!=-999:

 Max=listofmarks[0]

 break

 for i in range(1,len(listofmarks)):

 if listofmarks[i]>Max:

 Max=listofmarks[i]

 return(Max)

#<------------------------------------------------------------------------------------------------------>

# Function for Lowest score in the test for the class

def Minimum(listofmarks):

 for i in range(len(listofmarks)):

 if listofmarks[i]!=-999:

 Min=listofmarks[0]

 break

 for i in range(1,len(listofmarks)):

 if listofmarks[i]<Min:

 Min=listofmarks[i]

 return(Min)

#<------------------------------------------------------------------------------------------------------->

# Function for counting the number of students absent for the test

def absentcount(listofmarks):

 count=0

 for i in range(len(listofmarks)):

 if listofmarks[i]==-999:

 count+=1

 return(count)

#<------------------------------------------------------------------------------------------------------->

# Function for displaying marks with highest frequency

def maxFrequency(listofmarks):

 i=0

 Max=0

 print("Marks | Frequency")

 for j in listofmarks:

 if (listofmarks.index(j)==i):

 print(j," | ",listofmarks.count(j))

 if listofmarks.count(j)>Max:

 Max=listofmarks.count(j)

 mark=j

 i=i+1

 return(mark,Max)

#<------------------------------------------------------------------------------------------------------->

# Main function

marksinFDS=[]

numberofstudents=int(input("Enter total number of students : "))

for i in range(numberofstudents):

 marks=int(input("Enter marks of student "+str(i+1)+" : "))

 marksinFDS.append(marks)

flag=1

while flag==1:

 print("\n\n--------------------MENU--------------------\n")

 print("1. Total and Average Marks of the Class")

 print("2. Highest and Lowest Marks in the Class")

 print("3. Number of Students absent for the test")

 print("4. Marks with Highest Frequency")

 print("5. Exit\n")

 ch=int(input("Enter your Choice (from 1 to 5) :"))

 if ch==1:

 average(marksinFDS)

 a = input("Do you want to continue (yes/no) :")

 if a == "yes":

 flag = 1

 else:

 flag = 0

 print("Thanks for using this program!")

 elif ch==2:

 print("Highest Score in Class : ", Maximum(marksinFDS))

 print("Lowest Score in Class : ", Minimum(marksinFDS))

 a = input("Do you want to continue (yes/no) :")

 if a == "yes":

 flag = 1

 else:

 flag = 0

 print("Thanks for using this program!")

 elif ch==3:

 print("Number of Students absent in the test : ", absentcount(marksinFDS))

 a = input("Do you want to continue (yes/no) :")

 if a == "yes":

 flag = 1

 else:

 flag = 0

 print("Thanks for using this program!")

 elif ch==4:

 mark,fr = maxFrequency(marksinFDS)

 print("Highest frequency is of marks {0} that is {1} ".format(mark,fr))

 a = input("Do you want to continue (yes/no) :")

 if a == "yes":

 flag = 1

 else:

 flag = 0

 print("Thanks for using this program!")

 elif ch==5:

 flag=0

 print("Thanks for using this program!")

 else:

 print("!!Wrong Choice!! ")

 a=input("Do you want to continue (yes/no) :")

 if a=="yes":

 flag=1

 else:

 flag=0

 print("Thanks for using this program!")

#<---------------------------------------------END OF PROGRAM---------------------------------------







Output:

Enter total number of students : 10

Enter marks of student 1 : 80

Enter marks of student 2 : 30

6Enter marks of student 3 : 66

Enter marks of student 4 : 54

Enter marks of student 5 : 90

Enter marks of student 6 : 45

Enter marks of student 7 : 70

Enter marks of student 8 : 60

Enter marks of student 9 : 70

Enter marks of student 10 : 80

--------------------MENU--------------------

1. Total and Average Marks of the Class

2. Highest and Lowest Marks in the Class

3. Number of Students absent for the test

4. Marks with Highest Frequency

5. Exit

Enter your Choice (from 1 to 5) :1

Total Marks : 645

Average Marks : 64.50

Do you want to continue (yes/no) :yes

--------------------MENU--------------------

1. Total and Average Marks of the Class

2. Highest and Lowest Marks in the Class

3. Number of Students absent for the test

4. Marks with Highest Frequency

5. Exit

Enter your Choice (from 1 to 5) :2

Highest Score in Class : 90

Lowest Score in Class : 30

Do you want to continue (yes/no) :yes

--------------------MENU--------------------

1. Total and Average Marks of the Class

2. Highest and Lowest Marks in the Class

3. Number of Students absent for the test

4. Marks with Highest Frequency

5. Exit

Enter your Choice (from 1 to 5) :3

Number of Students absent in the test : 0

Do you want to continue (yes/no) :yes

--------------------MENU--------------------

1. Total and Average Marks of the Class

2. Highest and Lowest Marks in the Class

3. Number of Students absent for the test

4. Marks with Highest Frequency

5. Exit

Enter your Choice (from 1 to 5) :4

Marks | Frequency

80 | 2

30 | 1

66 | 1

54 | 1

90 | 1

45 | 1

70 | 2

60 | 1

Highest frequency is of marks 80 that is 2

Do you want to continue (yes/no) :yes

--------------------MENU--------------------

1. Total and Average Marks of the Class

2. Highest and Lowest Marks in the Class

3. Number of Students absent for the test

4. Marks with Highest Frequency

5. Exit

Enter your Choice (from 1 to 5) :5

Thanks for using this program!


GALLERY

GALLERY
photos

ABOUT

HTML CSS, VB.net Developer and Java, C programming. With Loves Problem Solving and to Unreval the Mysteries behind the Magic of Computer Programming

Followers

MY PROJECTS

Popular posts from this blog

FDS 5

 Practical No: -5 Experiment No. 6: Write a python program to store first year percentage of students in array. Write function for sorting array of floating-point numbers in ascending order using a) Selection Sort b) Bubble sort and display top five score Code: # Function for Selection Sort of elements def Selection_Sort(marks):  for i in range(len(marks)):  # Find the minimum element in remaining unsorted array  min_idx = i  for j in range(i + 1, len(marks)):  if marks[min_idx] > marks[j]:  min_idx = j  # Swap the minimum element with the first element  marks[i], marks[min_idx] = marks[min_idx], marks[i]  print("Marks of students after performing Selection Sort on the list : ")  for i in range(len(marks)):  print(marks[i]) #<---------------------------------------------------------------------------------------> # Function for Bubble Sort of elements def Bubble_Sort(marks):  n = len(marks)  # Traverse throug...

FDS 4

 Practical No: -4 Experiment No. 4: a) Write a python program to store roll numbers of student in array who attended training program in random order. Write function for searching whether particular student attended training program or not, using linear search and sentinel search. b) Write a Python program to store roll numbers of student array who attended training program in sorted order. Write function for searching whether particular student attended training program or not, using Binary search and Fibonacci search. Code: import array as arr # Accept the Roll Numbers of the students def accept_roll():  a = arr.array('I', [])  no_stud = int(input("Enter the number of Students : "))  for i in range(0, no_stud):  a.append(int(input("Enter the Roll Number : ")))  return a # Print the Roll Numbers of the Students def print_roll(a):  for i in range(0, len(a)):  print("\t", a[i], end=" ")  print() # Linear Search def linear_search(a, x):  f...

Contact us

Name

Email *

Message *