Count Occurrences of Character in List || Python

 

In this we are going to see a program to Count Occurrences of Character in a Random List in Python Programming Language.


import random

freq = 0
key = 2
l = []
min = 0
max = 10
for i in range(100):
    l.append(random.randint(min, max))

for i in l:
    if i == key:
        freq+=1
print(l)
print(f"{key} occurs {freq} times in the list")

# Coded by Saahil

#ENJOY CODING


1 Comments

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

  1. heyyyyyyyyy it was an amzing experience

    ReplyDelete

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post