The Study Buddy
Easy+10 XP · +5 Aurabasicsloopsconditionals
Rohan is preparing for his UptoSkills Arena exams and wants to know how many subjects he can potentially pass. He has a list of scores, one for each subject. To pass a subject, he needs a minimum score of 40. Given his scores, help Rohan count how many subjects he has scored 40 or more.
Input
The first line contains an integer N, the number of subjects. The second line contains N space-separated integers, Rohan's scores for each subject.
Output
Print a single integer: the count of subjects Rohan passed.
Constraints
1 <= N <= 1000 0 <= score <= 100
Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests
Example 1
Input
5 50 30 40 75 20
Output
3
Scores 50, 40, and 75 are >= 40. So, the count is 3.
Example 2
Input
3 10 20 30
Output
0
No scores are >= 40. So, the count is 0.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
Example 1 input
5 50 30 40 75 20
Example 2 input
3 10 20 30