How do I change this java code into a python code? And output the desired output shown in the image below. import java.util.*; public class Demo {   public static void main(String[] args) {     Scanner sc=new Scanner(System.in);     long min=Integer.MAX_VALUE;     long max=Integer.MIN_VALUE;     long sum=0;     int ignoreCount=0, numberCount=0;     while(true){       System.out.print("Please enter an integer value: ");       String s=sc.next();       try {         long n=Long.parseLong(s);          if(n<0)         break;         else if(n<0 || n>2000000000)         ignoreCount++;         else{           if(nmax)           max=n;           sum += n;           numberCount++;         }       }       catch(Exception e){         ignoreCount++;       }     }     System.out.println("The highest value is "+max);     System.out.println("The lowest value is "+min);     System.out.println("The avergae value is "+sum/numberCount);     System.out.println(ignoreCount+" entry was ignored");   } }

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter7: String Manipulation
Section: Chapter Questions
Problem 16E
icon
Related questions
Question

How do I change this java code into a python code? And output the desired output shown in the image below.


import java.util.*;
public class Demo {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    long min=Integer.MAX_VALUE;
    long max=Integer.MIN_VALUE;
    long sum=0;
    int ignoreCount=0, numberCount=0;
    while(true){
      System.out.print("Please enter an integer value: ");
      String s=sc.next();
      try {
        long n=Long.parseLong(s); 
        if(n<0)
        break;
        else if(n<0 || n>2000000000)
        ignoreCount++;
        else{
          if(n<min)
          min=n;
          if(n>max)
          max=n;
          sum += n;
          numberCount++;
        }
      }
      catch(Exception e){
        ignoreCount++;
      }
    }
    System.out.println("The highest value is "+max);
    System.out.println("The lowest value is "+min);
    System.out.println("The avergae value is "+sum/numberCount);
    System.out.println(ignoreCount+" entry was ignored");
  }
}

Please enter an integer value: 5
value: 15
Please enter an integer
Please enter an integer value: 3
Please enter an integer value: a
Please enter an integer value: 20
Please enter an integer value: 5
Please enter an integer value: -1
The highest value is 20
The lowest value is 3
The avergae value is 9
1 entry was ignored
Transcribed Image Text:Please enter an integer value: 5 value: 15 Please enter an integer Please enter an integer value: 3 Please enter an integer value: a Please enter an integer value: 20 Please enter an integer value: 5 Please enter an integer value: -1 The highest value is 20 The lowest value is 3 The avergae value is 9 1 entry was ignored
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage