0

Recently I was learning Python,and I know how to use usual loop of for,but I can't understand the following codes of for loop in python.Please show me a website to learn the details or explain how to use it,thank you very much;

def billboard(name, price = 30):
    return sum(price for ch in name)
vaultah
  • 44,105
  • 12
  • 114
  • 143
Jason
  • 49
  • 1
  • 1
  • 6

1 Answers1

-2
def billboard(name, price = 30):
    return [price + ch for ch in name]

This should do the trick

jackal
  • 115
  • 2
  • 10