Question
IN PYTHON
write a program that asks the user to enter 10 numbers and store them in the list and then find the followings: • Maximum • M
0 0
Add a comment Improve this question Transcribed image text
Answer #1

PLEASE GIVE IT A THUMBS UP

nikhil@nikhil-Vostro-15-3568: -/Desktop/CODE File Edit View Search Terminal Help nikhil@nikhil-Vostro-15-3568:-/Desktop/CODE$

def maximum(num):
   m=num[0]
   i=1
   while(i<len(num)):
       if(m<num[i]):
           m=num[i]
       i+=1
   print("Maximum: "+str(m))

def minimum(num):
   m=num[0]
   i=1
   while(i<len(num)):
       if(m>num[i]):
           m=num[i]
       i+=1
   print("Minimum: "+str(m))

def isPrime(n) :   
if (n <= 1) :
return False
if (n <= 3) :
return True
if (n % 2 == 0 or n % 3 == 0) :
return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True

def prime(num):
   print("Prime numbers")
   for i in num:
       if(isPrime(i)==True):
           print(i)

def even(num):
   print("Even numbers")
   for i in num:
       if(i%2==0):
           print(i)

def odd(num):
   print("Odd numbers")
   for i in num:
       if(i%2!=0):
           print(i)

print("Enter 10 numbers")
num = []
i=0
while(i<10):
   n = int(input())
   num.append(n)
   i+=1
maximum(num)
minimum(num)
prime(num)
even(num)
odd(num)

~/Desktop/CODE/demo.py (CODE) - Sublime Text (UNREGISTERED), File Edit Selection Find View Goto Tools Project Preferences Hel

~/Desktop/CODE/demo.py (CODE) - Sublime Text (UNREGISTERED), Tools Project Preferences Help File Edit Selection Find View Got

Add a comment
Know the answer?
Add Answer to:
IN PYTHON write a program that asks the user to enter 10 numbers and store them...
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
  • Description: Write a program that asks the user to enter a series of numbers, and report...

    Description: Write a program that asks the user to enter a series of numbers, and report the following: • The maximum number in the series • The minimum number in the series • The average of all positive numbers in the series The user will enter a pound key ‘#’ to stop the series. in Python

  • Write a java program that asks the user to enter 2 integers, obtains them from the...

    Write a java program that asks the user to enter 2 integers, obtains them from the user, determines if they are even or odd numbers and prints their sum, product, difference, and quotient (Division).

  • Extra Credit Assignment 4 Write a PYTHON program that asks the user to enter a series...

    Extra Credit Assignment 4 Write a PYTHON program that asks the user to enter a series of numbers. You can decide how many numbers to enter or the user can. As the user enters each number, add it to a list. After all the numbers are added, determine: What is the highest number in the list What is the lowest number in the list What is the sum of all the numbers in the list No error checking is required....

  • write a program code that asks the user how many numbers they wish to find the...

    write a program code that asks the user how many numbers they wish to find the statistics of and then asks the user to enter those numbers. The program must then calculate and display the average variance and standard deviation of the numbers entered by the user. the program code must -ask three user how many numbers they wish to find the statistics of -ask the user to enter those numbers and store them in an array - use a...

  • Write a program that asks the user to enter a string and then asks the user...

    Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming

  • USING PYTHON 1. Write a small program that asks for an integer number from the user...

    USING PYTHON 1. Write a small program that asks for an integer number from the user and print all the prime numbers (2,3,5,7,etc) less than the input number. 2. How long it takes for your program to print the prime numbers less than 100. (Use magic functions)

  • 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...

  • Write a Java program that: • Asks the user to enter the number of integers that...

    Write a Java program that: • Asks the user to enter the number of integers that he need to enter; • Asked him to enter integer by integer; • Print The number of Odd numbers entered and the number of Even numbers entered. Important notes: 1. You should have to copy and paste the Java as your answer for this question. DON’T take screen shot for your Java Code. It must be editable. 2. Take a screen shot for your...

  • Write a C++ program that asks the user to enter a single number from 1 to...

    Write a C++ program that asks the user to enter a single number from 1 to 50 and a choice of "even" or "odd". Using a recursive function, output the sum of all the even or odd integers from 1 up to (and including) that number. Your program does not need to loop and accept more input (only one input of the number then even/odd).

  • python - Write a program that asks the user to enter how much their dinner bill...

    python - Write a program that asks the user to enter how much their dinner bill was. Then ask them how many people were in their party. If there were more than 6 people in their party automatically calculate a 20% tip. If there were 6 or less people in their party ask them what percentage they would like to tip. In all cases, print out the total amount of the tip at the end of the program.

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