Computer Science, asked by Trianguz, 3 months ago

Write a program to find the number of times element 8 occurs in a list.​

Answers

Answered by jai696
4

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

from random import randrange

l = [randrange(1, 10) for n in range(69)]

print(l)

print("\nOccurences of 8:", len([n for n in l if n == 8]))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by allysia
0

Answer:

Using python:

\\\tt a=list(in put("Enter\ elements\ together\ for\ a\ list: ")) \\\tt count=0\\\tt for\ i\ in\ a: \\\tt{\qquad    if\ i=="8":}\\\tt{\qquad {\qquad        count+=1}} \\\tt{\qquad    else:} \\\tt {\qquad {\qquad        pass}} \\\tt print(count)

Similar questions