Calculate the average weights of people

Assignment Help Python Programming
Reference no: EM132356467

Question

Suppose we have a text file, records.txt, of people's names and their weights. Each line of the file contains one name and one weight, separated by a single space.

Here is a sample file: Jack 80 Jill 100 Peter 96 Jenny 155 Write the definition of the function avg_weight, which returns the average weight of the people included in the file.

The function takes in a one character config parameter, calculating the average weights of people whose names begin with the letter specified in the config parameter.

If given the letter J, with the function call avg_weight(‘J'), the function would only compute the average weight people whose names began with the letter J - Jack, Jill, and Jenny, ignoring Peter's weight, in the sample file shown above. If given the star character * however, with the function all avg_weight(‘*') , the function includes the weight of every person in the file in the calculation.

def avg_weight(config: str) -> float

Reference no: EM132356467

Questions Cloud

Discuss the domestic terrorist event : Discuss the domestic terrorist event. Provide information about the critical infrastructure that was impacted and how the role of protecting this infrastructure
Compute and display the charges for a patients hospital stay : Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask patient name and if the patient was admitted
Display the average score accurate to three decimal places : Write program that can be used to determine the average of a number of percent tests. Display the average score accurate to three decimal places.
Explain the difference between nominal and ordinal data : Big Data is everywhere and various businesses around the world are driven by Big Data. However, while some businesses rely on Big Data for organizational.
Calculate the average weights of people : Calculate the average weights of people whose names begin with the letter specified in the config parameter. Write the definition of the function avg_weight.
Define characteristics of a basic ell level and accounts : Include a 500-750-word summary below the chart (within the same document) that contains rationales for each of the three domains that describes.
Convert between temperatures in fahrenheit : Write a Python application that allows the user to convert between temperatures in fahrenheit and temperatures in celsius.
Understanding of research theory and techniques : ITECH 5500 Professional Research and Communication - Demonstrate a critical awareness of previous research in an IT context within a chosen topic area through
Write class that takes in a float initial balance : Write class BankAccount that takes in a float initial balance initial_balance. The class should have two operations - a method for deposit and a method for with

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program that starts from the starting state

Task consists of programming a Python implementation of a solver for the Desert Crossing Task - write a Python program that starts from the starting state.

  Write a python script that reads the child mortality data

ICT702 : Write a Python script that reads and analyses the child mortality data file (WHOSIS_MDG_000003.csv) and produce at least FIVE.

  Simulate a game of rock-paper-scissors

Write a program that utilizes functions to simulate a game of rock-paper-scissors. Write a program that allows the user to play Rock, Paper, Scissors.

  The dictionary order based on the ascii order

Needless to say, the dictionary order based on the ASCII order is not what a real-world indexing software wants. So, we want to implement the dictionary order of strings in the standard wa

  Write a program that keeps a dictionary in which both keys

Write a program that keeps a dictionary in which both keys and values are strings - names of students and their course grades.

  Display the dollars and quarters and dimes and nickels

Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive in return. In order to avoid roundoff errors.

  Write a function rmduplic(l), where l is any list

Write a function rmDuplic(L), where L is any list. The function should return a list M that contains the same items as L, except that repetitions (duplicates) have been removed: only the first occurrence of each entry is kept (i.e., order is prese..

  Write a python code for smart contract for blockchain

You need a Python code for " Smart contract" for Blockchain with Pyethereum , Pyethereum package in Python.

  Write a program in python to draw a simplified face

Write a program in Python to draw a blue triangle in a drawing window. Write a program in Python that moves the triangle in an animated movement. Write a program in Python to draw a simplified face.

  Write a program that prints the longest substring

HIT137 SOFTWARE NOW - Charles Darwin University - Write a program that prints the longest substring - Write a python program that allows the user to navigate

  Create a program that calculates the total for a purchase

Create a program that calculates the total for a purchase at a bookstore. The program should round the results to a maximum of two decimal places.

  Properties of a typical vending machine product

ITECH1400 - Foundations of Programming - Vending Machine - Identification of properties of a typical vending machine Product

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd