1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kay [80]
3 years ago
7

Create a Python script that enables a user to enter an integer number into the Python console and stores such integer number int

o a variable named input1. Use an if statement to print the following output per the following conditions:If integer is a negative number, print in console "Input1 integer is negative"If integer is zero, print in console "Input 1 integer is zero"If integer is a positive number less or equal than 30, print in console "Input 1 is positive but less or equal than 30.If integer is a positive number greater than 30, print in console "Input1 is positive and greater than 30"

Computers and Technology
1 answer:
DIA [1.3K]3 years ago
6 0

Answer:

Here is the Python program:

input1 = int(input("Enter an integer: ")) #prompts user to enter an integer

if(input1<0): #if input value is negative

    print("Input1 integer is negative")

elif(input1==0): #if input value is 0

    print("Input 1 integer is zero")

elif(input1<=30): #if input value is less than or equal to 30

    print("Input 1 is positive but less or equal than 30")

else: #if input value is greater than 30

    print("Input 1 is positive and greater than 30")    

Explanation:

I will explain the program with an example

Lets say user enters 16 as input So

input1 = 60

Now the first if condition if(input1<0): is false because 60 is not less than 0

The second elif (else if) condition elif(input1==0): also evaluates to false because 60 is not equals to 0

The third elif condition elif(input1<=30): evaluates to false because the input value is 60 which is not less than or equal to 30.

The fourth else part executes because all the above if elif conditions evaluate to false which means the input number if neither negative, nor 0 and not less than or equal to 30. Hence the input number is greater than 30 and this is true as 60 is greater than 60. So the print statement executes which is:

    print("Input 1 is positive and greater than 30")

The message in the above print statement is printed on the output screen.

The screenshot of the program along with its output is attached.

You might be interested in
There are two common computer platforms for both PC and MAC users. Which term best describes this function?
andrezito [222]

Operating system (OS)

5 0
3 years ago
The best way to ensure the accuracy and safety of your accounts is to:
Gekata [30.6K]
Use symbols and a different password for each one

6 0
3 years ago
(JAVA PLS)
Elza [17]

import java.util.Scanner;

public class JavaApplication54 {

   public static int appearance(String word, char letter){

       int count = 0;

       for (int i = 0; i < word.length(); i++){

           if (word.charAt(i) == letter){

               count++;

           }

       }

       return count;

   }

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Type the message to be shortened");

       String message = scan.nextLine();

       message = message.toLowerCase();

       int volCount = 0, repCount = 0, num = 0;

       char prevC = ' ';

       String vowels = "aeiou";

       String newMessage = "";

       for (int i = 0; i < message.length(); i++){

           char c = message.charAt(i);

           

           if (vowels.indexOf(c) != -1 && prevC == ' '){

               newMessage += c;

           }

           else if (vowels.indexOf(c) == -1 && prevC != c){

               newMessage += c;

           }

           else if (vowels.indexOf(c) != -1){

               volCount ++;

           }

           else{

               repCount++;

           }

            prevC = c;

       }

       System.out.println("Algorithm 1");

       System.out.println("Vowels removed: "+volCount);

       System.out.println("Repeats removed: "+repCount);

       System.out.println("Algorithm 1 message: "+newMessage);

       System.out.println("Algorithm 1 characters saved: "+(message.length() - newMessage.length()));

       

       String uniqueMessage = "";

       

       for (int i = 0; i<message.length(); i++){

           char w = message.charAt(i);

           if (uniqueMessage.indexOf(w)== -1 && w!=' '){

               uniqueMessage += appearance(message,w)+""+w;

               num++;

           }

       }

       System.out.println("Algorithm 2");

       System.out.println("Unique characters found: "+num);

       System.out.println("Algorithm 2 message: "+uniqueMessage);

       System.out.println("Algorithm 2 characters saved: "+(message.length() - uniqueMessage.length()));

   }

   

}

I hope this helps!

6 0
3 years ago
¿Que es el simulador de vuelo en Google Earth?
Dimas [21]
Guat da fak did u say 
4 0
4 years ago
Why do I need to get brainly plus when I already created an account
allochka39001 [22]

Answer:

They want more money I suppose

7 0
3 years ago
Read 2 more answers
Other questions:
  • Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
    6·1 answer
  • Drag the tiles to the correct boxes to complete the pairs. Match the tools that you can use while solving a problem with their c
    6·2 answers
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • A right turn should be from the right lane into the right lane of the roadway entered. True or false. A. True B. False
    11·1 answer
  • Write a (java) program with a class called Sum1, using a while loop to add 10 numbers entered from the key-board.
    5·1 answer
  • Which of the following statements about light-emitting diodes is correct
    11·1 answer
  • Which is a good guideline to follow when looking for research material on the Internet?
    10·2 answers
  • Many companies ban or restrict the use of flash drives
    11·1 answer
  • I WILL GIVE MOST BRAINLY
    13·1 answer
  • 15. It is the process of capturing data or translating information to recording format
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!