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
yaroslaw [1]
3 years ago
5

Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list and then dis

play the following data: • The lowest number in the list • The highest number in the list • The total of the numbers in the list • The average of the numbers in the list
Computers and Technology
1 answer:
Aleksandr-060686 [28]3 years ago
6 0

Answer:

The following are the program in the Python Programming Language.

#declare the list  

lst=[]

#set the for loop  

for num in range(1,21):

 #get the element of the list from the user

 n=int(input('Enter the {} element :' .format(num)))

 #add elements in the list

 lst.append(n)

print()

#print the minimum number in list

print('The lowest number in the list: ',min(lst))

#print the maximum number in list

print('The highest number in the list: ',max(lst))

#print the total of the list

print('The total of the numbers in the list: ',sum(lst))

#print the average of the list

print('The average of the numbers in the list: ',sum(lst)/len(lst))

<u>Output</u>:

Enter the 1 element :53

Enter the 2 element :65

Enter the 3 element :41

Enter the 4 element :23

Enter the 5 element :21

Enter the 6 element :12

Enter the 7 element :96

Enter the 8 element :85

Enter the 9 element :74

Enter the 10 element :98

Enter the 11 element :75

Enter the 12 element :41

Enter the 13 element :54

Enter the 14 element :56

Enter the 15 element :36

Enter the 16 element :25

Enter the 17 element :14

Enter the 18 element :12

Enter the 19 element :45

Enter the 20 element :65

The lowest number in the list:  12

The highest number in the list:  98

The total of the numbers in the list:  991

The average of the numbers in the list:  49.55

Explanation:

<u>The following are the description of the program</u>.

  • Firstly, we declare the empty list type variable 'lst' to store elements.
  • Then, set the for loop statement that iterates from 1 and end at 20.
  • Then, set a variable that get elements of the list from the user and appends those user defined inputs in the list type variable 'lst'.
  • Finally, print the lowest and the largest elements in the list as well as print the total and average of the elements in the list.
You might be interested in
Write a Java program to encrypt and decrypt a phrase using two similar approaches, each insecure by modern standards. The first
xeze [42]

Answer:

See explaination

Explanation:

//CryptoManager.java

public class CryptoManager {

static int LOWER_BOUND=32;

static int UPPER_BOUND=95;

/*This method determines if a string is within the allowable bounds of ASCII

codes according to the LOWER_BOUND and UPPER_BOUND characters. The parameter

plainText is the string to be encrypted. The method returns true if all

characters are within the allowable bounds, false if any character is outside.*/

public static boolean stringInBounds (String plainText)

{

boolean flag=true;

//determines if a string is within the allowable bounds of ASCII

//codes according to the LOWER_BOUND and UPPER_BOUND characters.

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

{

if(!((int)plainText.charAt(i)>=LOWER_BOUND && (int)plainText.charAt(i)<=UPPER_BOUND))

{ //false if any character is outside the bounds

flag=false;

break;

}

}

//returns true if all characters are within the allowable bounds

return flag;

}

/*This method encrypts a string according to the Caesar Cipher. The integer key

specifies an offset and each character in plainText is replaced by the character

the specified distance away from it. The parameter plainText is an uppercase

string to be encrypted. The parameter key is an integer that specifies the

offset of each character. The method returns the encrypted string.*/

public static String encryptCaesar(String plainText, int key)

{

//Wrap around the key, if it is greater than the UPPER_BOUND

key=Wrap_around(key);

//encrypted text

String res="";

//encryption

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

{

res+=Character.toString((char) ((int)plainText.charAt(i)+key));

}

//return result

return res;

}

/* This method decrypts a string according to the Caesar Cipher. The integer

key specifies an offset and each character in encryptedText is replaced by

the character "offset" characters before it. This is the inverse of the

encryptCaesar method. The parameter encryptedText is the encrypted string

to be decrypted, and key is the integer used to encrypt the original text.

The method returns the original plain text string.*/

public static String decryptCaesar(String encryptedText, int key){

//Wrap around the key, if it is greater than the UPPER_BOUND

key=Wrap_around(key);

//decrypted text

String org="";

//encryption

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

{

org+=Character.toString((char) ((int)encryptedText.charAt(i)-key));

}

//return result

return org;

}

public static int Wrap_around(int key)

{

while(key>UPPER_BOUND)

{

key-=(UPPER_BOUND-LOWER_BOUND);

}

return key;

}

/* This method encrypts a string according to the Bellaso Cipher. Each character

in plainText is offset according to the ASCII value of the corresponding

character in bellasoStr, which is repeated to correspond to the length of

plaintext. The method returns the encrypted string.*/

public static String encryptBellaso(String plainText, String bellasoStr)

{

//encrypted text

String res="";

//Adjust length of bellasoStr to plainText

while(bellasoStr.length()<plainText.length())

{

bellasoStr+=bellasoStr.substring(0,(plainText.length()-bellasoStr.length()));

}

//encryption

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

{

char c=(char)Wrap_around((int)plainText.charAt(i)+(int)bellasoStr.charAt(i) );

res+=Character.toString(c);

}

//return result

return res;

}

/*

This method decrypts a string according to the Bellaso Cipher. Each character

in encryptedText is replaced by the character corresponding to the character in

bellasoStr, which is repeated to correspond to the length of plainText. This is

the inverse of the encryptBellaso method. The parameter encryptedText is the

encrypted string to be decrypted, and bellasoStr is the string used to encrypt

the original text. The method returns the original plain text string.*/

public static String decryptBellaso(String encryptedText, String bellasoStr)

{

//decrypted text

String res="";

//Adjust length of bellasoStr to plainText

while(bellasoStr.length()<encryptedText.length())

{

bellasoStr+=bellasoStr.substring(0,(encryptedText.length()-bellasoStr.length()));

}

//decryption

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

{

char c=(char)Wrap_around((int)encryptedText.charAt(i)-(int)bellasoStr.charAt(i) );

res+=Character.toString(c);

}

//return result

return res;

}

}

6 0
2 years ago
Kelly wants to change the text in a cell so that it is centered instead of left-aligned, where should she look to make this
timurjin [86]

Answer:

c

Explanation:

I don't know if it's correct

make me brainlist

4 0
2 years ago
Write a java program called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the numbe
Vlada [557]

Answer:

public class Digits

{

   public static boolean allDigitsOdd(int num)

   {

       boolean flag=true;

       int rem;

       while(num>0)

       {

           rem=num%10;

           num=num/10;

           if(rem%2==0)    // if a even digit found immediately breaks out of loop

           {

               flag=false;

               break;

           }

       }

       return flag;     //returns result

   }

   public static void main(String args[])

   {

       System.out.println(allDigitsOdd(1375));    //returns true as all are odd digits

   }

}

OUTPUT :

true

Explanation:

Above program has 2 static methods inside a class Digits. Logic behind above function is that a number is divided by 10 until it is less than 0. Each time its remainder by 0 is checked if even immediately breaks out of the loop.

4 0
3 years ago
True or false, cloud storage does not require internet access?
Dmitry_Shevchenko [17]
False, the storage is being accessed from the cloud which can only be accessed through an internet connection.
3 0
3 years ago
What could cause this? An App Builder wants to show Groups as the last navigation menu item in the Salesforce1 Mobile App. Howev
sasho [114]

Answer:

Option B is the correct option.

Explanation:

In the above scenario, When they wanted to demonstrate Groups as the last menu item for navigation in the Mobile App. Then, they can't select Groups as among the elements in the drop-down menu though.

So, the following scenario causes that the Groups are not contained in the selected list for the navigation menu.

4 0
3 years ago
Other questions:
  • To join two or more objects to make a larger whole is to _____________ them.
    8·2 answers
  • Which of these is an aggregator?
    9·2 answers
  • An internet connection is required to access which type of software?
    5·1 answer
  • To copy both character attributes and paragraph attributes, such as alignment and indentation, select the entire paragraph. TRUE
    14·1 answer
  • Which of the following provides services to hosts on its network?
    9·1 answer
  • In addition to ranking the relevance of a particular site according to the keywords entered by the user, which of the following
    10·1 answer
  • Help me to write spaghetti stack function, please!!
    11·1 answer
  • Previous
    11·1 answer
  • How do you customize calendar view​
    9·2 answers
  • Which spreadsheet feature could the scholarship committee use to locate applicants who meet the criteria?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!