Skip to content

Instantly share code, notes, and snippets.

@Deniz97
Created February 17, 2021 07:10
Show Gist options
  • Select an option

  • Save Deniz97/91ffef27fdcb28cf32ab3cab7e231d1e to your computer and use it in GitHub Desktop.

Select an option

Save Deniz97/91ffef27fdcb28cf32ab3cab7e231d1e to your computer and use it in GitHub Desktop.
with open("sample_prices.txt", "r") as filem:
lines = filem.readlines()
datas = [ (x.split(":")[0], int(x.split(":")[1])) for x in lines]
avg_price = sum([ x[1] for x in datas]) / len(datas)
for p in datas:
if p[1]>avg_price and ((p[1] % 2) == 0):
print(p[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment