subject

# program-01-steps Using steps. py in this repository for a starter file, write a Python program to calculate average number of steps per month for a year.
The input file (which you will read from the command line, see the sample program on how to read command line arguments in this repository) contains the number of steps (integer) a person took each day for 1 year, starting January 1. Each line of input contains a single number.
Assume this is NOT a leap year.
Your output must follow this format:
```
The average steps taken in MONTH NAME was 9999.9
```
Where 9999.9 represents that month's average. Be sure to output only a single decimal digit (digit to the right of the decimal)
Be sure to spell out the name of the month. First letter must be caps. For example: June
For a grade of A your program should handle a leap year by looking at the number of steps in the file, if 365 then non leap year, if 366 then leap year.
***commandlines. py***
# Python program to demonstrate
# command line arguments
# notice that the first command line argument that is passed to a program comes after the name of the program file
# it has an array index of 1 in the sys. argv array
# sys. arg[0] is always the name of the python program file
# all command line arguments are strings, so if you want to perform math you have to convert

import sys
# total arguments
n = len(sys. argv)
print("Total arguments passed: %i" % n)
# Arguments passed
print("\nName of Python script: %s" % sys. argv[0])
print("\nArguments passed:")
for i in range(1, n):
print("%s" % sys. argv[i])
# Addition of numbers
Sum = 0
for i in range(1, n):
Sum += int(sys. argv[i])
print("\n\nResult: %i" % Sum)
***steps. py***
# Named constants - create one for each month to store number of days in that month; assume this is NOT a leap year
def main():
# Open the steps file using the first command line argument to get the input file name. For example: python steps. py steps. txt would open the file steps. txt to read the steps
# Display the average steps for each month using a function to calculate and display
# Close the file.
def average_steps(steps_file, month_name, days):
# compute the average number of steps for the given month
# output the results
main()

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:10
In mathematics and computer science, a set is a collection in which order does not matter and there are no duplicates. in this problem, we are going to to define a class which wil allow us to create an object to represent a set of integers. you will write a program set.java to define the class set. each instance of the class set will be an object representing a set of integers.
Answers: 3
question
Computers and Technology, 22.06.2019 12:20
Usually, when we sniff packets, we are only interested certain types of packets. we can do that by setting filters in sniffing. scapy’s filter use the bpf (berkeley packet filter) syntax; you can find the bpf manual from the internet. set the following filters and demonstrate your sniffer program again (each filter should be set separately): (a) capture only the icmp packet. (b) capture any tcp packet that comes from a particular ip and with a destination port number 23. (c) capture packets comes from or to go to a particular subnet. you can pick any subnet, such as 128.230.0.0/16; you should not pick the subnet that your vm is attached to.
Answers: 3
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
You know the right answer?
# program-01-steps Using steps. py in this repository for a starter file, write a Python program t...
Questions
question
Mathematics, 21.04.2021 02:30
question
Mathematics, 21.04.2021 02:30
question
Mathematics, 21.04.2021 02:30
question
Mathematics, 21.04.2021 02:30
question
Physics, 21.04.2021 02:30
Questions on the website: 13722360