For loop



Exercise

1. After flipping a coin 10 times you got this result,

    result = ["heads","tails","tails","heads","tails","heads","heads","tails","tails","tails"]

    Using for loop figure out count for “heads”

2. Your monthly expense list (from Jan to May) looks like this,

    expense_list = [2340, 2500, 2100, 3100, 2980]

    Write a program that asks you to enter an expense amount and program should tell you in which month that expense occurred. If expense is not found then convey   that as well

3. Write a program that prints following shape, (Hint: Use for loop inside another for loop)

    *

    **

    ***    

    ****

    *****


Download Answers