Question

Question 4-6 Please.

Python 3.6. def main().

entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The radius is entered by the user. Two points in a plane are specified using the coordinates (x1, yl) and (x2, y2). Write a program that calculates the slope of a line through two (non-vertical) points entered by the uscr. m 2-yl Using this same point, your program should also determine the distance between (xl and (x2, y2). Use the following formula to calculate distance x2 x1 , y1) 4. Write a program that finds the sum of the squares for the first n natural numbers. 5. Write a program to find the sum of the cubes of thc first n natural numbers where the valuc of n is provided by the user 6. Write a program which takes 2 digits, X, Y as input from the keyboard and calculates the sum of the integers from X to Y. In context, X is smaller than Y Examplc: if the input is 1, 3, your program output will be 6.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def main():
    n = int(input('How many numbers do you want to enter? '))
    total = 0
    for i in range(n):
        num = float(input('Enter a number: '))
        total += num
    print('Total: ' + str(total))
    print('Average: ' + str(total/n))

main()

How many numbers do you want to enter? Enter a number: Enter a number: Total: 20.0 Average:4.0 Process finished with e xit co

as\;per\;guidelines\;we\;are\;only\;allowed\;to\;answer\;first\;question\\ Please\;make\;separate\;posts\;for\;remaining\;questions\\ Thanks

Add a comment
Know the answer?
Add Answer to:
Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Collassa Question 2 Not yet ansered Merced out of 2000 OP Write a program to calculate...

    Collassa Question 2 Not yet ansered Merced out of 2000 OP Write a program to calculate the distance between the two points. Note: x1, y1, 22. 72 are all double values. You can use the following formula to calculate the distance between the two points. (x2 - x)2 + (y2 – y,)? Sample run: Input xd: 25 Input yl: 15 Input x2: 35 Input y2: 10 Distance betieen the said points: 11.1883 tnopalam hilarati

  • In Python: Write a program that determines whether two circles intersect. The input should consist of...

    In Python: Write a program that determines whether two circles intersect. The input should consist of six numbers, x1, y1, r1 and x2, y2, r2, given as command-line arguments, and representing the center and radius of the two circles. Your program should print True if the two circles intersect, and False otherwise. As a reminder, the two circles intersect if and only if the distance of their two centers is less than or equal to the sum of their two...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • Python 3.6 "While Loops" Write a program that adds up a series of numbers entered by...

    Python 3.6 "While Loops" Write a program that adds up a series of numbers entered by the user. The user should enter each number at the command prompt. The user will indicate that he or she is finished entering the number by entering the number 0.   Example This program will sum a series of numbers. Enter the next number (enter 0 when finished) > 5 Enter the next number (enter 0 when finished) > 2 Enter the next number (enter...

  • IN PYTHON Write a program that takes a user-input distance and speed and then calculates an...

    IN PYTHON Write a program that takes a user-input distance and speed and then calculates an ETA. Your program should work for ANY COMBINATION of distance and speed.

  • write the program in Latex form and please type it out. ECE 270 Advanced Computer Methods in ECE Assignment #1 May 1...

    write the program in Latex form and please type it out. ECE 270 Advanced Computer Methods in ECE Assignment #1 May 14, 2019/Instructor. Paul Watta Write a program that asks the user to enter two coordinate points and computes the resulting equation of the line. A typical output is shown below Zinear Equation Creator Given (xi, yi) and (x2, y2), this program computes the equation of the line: Please enter xi yl: -1 -1 Please enter x2 y2: 1 5...

  • Intro to Python: Q1: Bonnie is writing a Python program for her math class so she can check her answers quickly. She is...

    Intro to Python: Q1: Bonnie is writing a Python program for her math class so she can check her answers quickly. She is having some difficulties, however, because when she enters values like 3.5 or 2.71 her program throws an error. She has heard of your expertise in Python and asks for your help. What error is being thrown and how can she fix the program to accept values like 3.5 or 2.71? from math import sgrt def distance (coorl,...

  • In C++ Sorted List of User Entered Numbers 2. Write a program that reads in a...

    In C++ Sorted List of User Entered Numbers 2. Write a program that reads in a list of integers into a vector with base type int. Provide the facility to read this vector from an input file. Make sure to ask the user for a filename. The output is a two-column list. The first column is a list of the distinct vector elements. The second column is the count of the number of occurrences for each element. The list should...

  • USING PYTHON PLEASE Write a program that calculates the factorial value of a number entered by...

    USING PYTHON PLEASE Write a program that calculates the factorial value of a number entered by the user. Remember that x! =x* (x-1)* (x-2)*... *3+ 2* 1. Your program should check the value input by the user to ensure it is valid (i.e., that it is a number > =1). To do this, consider looking at the is digit() function available in Python. If the user enters an incorrect input, your program should continue to ask them to enter a...

  • Write a python program that does the following. a. It asks the user to enter a...

    Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT