AverageNum

    0

    0

    Mahendra Kumar

    beginnerbasicMaths

    Calculating the Average of N Numbers

    # total number you want to enter
    n = int(input('How many numbers: '))
    # denotes total sum of n numbers
    total_sum = 0
    for i in range (n):
        # take inputs
        num = float(input('Enter number: '))
        # calculate total sum of numbers
        total_sum += num
    # calculate average of numbers
    avg = total_sum / n
    # print average value
    print('The average value of numbers = %0.2f' %avg)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.