0

DAN BROWN.. in python

Description Rahul likes to read novels a lot. Everybody knows that his favorite author is Dan Brown. He has a huge collection of novels and he would like to know how many of them are from Dan Brown. Fortunately, he has a friend like you so now it's your duty to help him out. Your task is to create a function named count which accepts a list as an argument containing the names of the authors and returns the total count of 'Dan Brown' in it. Input The 1st line will contain t, the number of test cases. Each test case will contain a single integer n defining the name of the book's author. Output For each test case print the count of Dan Brown's books on a separate line. Constraints 1<=t<=10 1<=n<=100 D Sample test case Input 1 4 William Shakespeare Dan Brown Chetan Bhagat Dan Brown Output 2 My attempt https://code.sololearn.com/cTE4X6eV3FnI/?ref=app

29th Sep 2021, 10:44 AM
Manoj Kumar T
Manoj Kumar T - avatar
5 Antworten
+ 10
Màñøj , before we can help you, you should show us your attempt first. if you have not done a try by yourself upto now, please do so. Put your code in playground and link it here. thanks!
29th Sep 2021, 10:58 AM
Lothar
Lothar - avatar
30th Sep 2021, 5:20 AM
Oma Falk
Oma Falk - avatar
+ 2
Màñøj how about learning list comprehension? Brings your skills to a new level and makes your code shorter
30th Sep 2021, 5:22 AM
Oma Falk
Oma Falk - avatar
0
24th Apr 2022, 1:16 PM
Siddharth Lokhande
0
DESCRIPTION Rahul likes to read novels a lot. Everybody knows that his favorite author is Dan Brown. He has a huge collection of novels and he would like to know how many of them are from Dan Brown. Fortunately, he has a friend like you so now it's your duty to help him out. Your task is to create a function named count which accepts a list as an argument containing the names of the authors and returns the total count of Dan Brown in it. Input The 1st line will contain t the number of test cases. Each test case will contain a single Integern defining the name of the book's author. Output For each test case print the count of Dan Brown's books on a separate line. Constraints 1<=t<=10 1<=n<=100 Sample test case Input William Shakespeare Dan Brown Chetan bhagat Dan Brown Output 2 Generate the code according to this #Read the variable from STDIN a = int (raw_input()) # Output the variable to STDOUT print a
9th Jul 2023, 3:42 AM
karan asawa
karan asawa - avatar