We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def countApplesAndOranges(s, t, a, b, apples, oranges):
# Write your code here
new_app_cord=[a+app for app in apples]
new_orr_cord=[b+orr for orr in oranges]
ca=0
co=0
for app in new_app_cord:
if app>=s and app<=t:
ca+=1
for orr in new_orr_cord:
if orr>=s and orr<=t:
co+=1
print(ca,co,sep="\n")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
def countApplesAndOranges(s, t, a, b, apples, oranges): # Write your code here new_app_cord=[a+app for app in apples] new_orr_cord=[b+orr for orr in oranges] ca=0 co=0 for app in new_app_cord: if app>=s and app<=t: ca+=1 for orr in new_orr_cord: if orr>=s and orr<=t: co+=1 print(ca,co,sep="\n")