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
bogdanovich [222]
3 years ago
7

Python exercise grade 10

Computers and Technology
1 answer:
Lemur [1.5K]3 years ago
5 0

nums = []

while True:

   num = float(input("Enter a number: "))

   if num <= 0:

       break

   nums.append(num)

print("The largest number entered was",max(nums))

I wrote my code in python 3.8. I hope this helps.

You might be interested in
1,2,3,4,5,6,7,8,9,10 – Best case - Sorted in ascending order
Pepsi [2]

Using the knowledge in computational language in python it is possible to write a code that from a random number draw creates an order of increasing numbers

<h3>Writting the code in python:</h3>

<em>def shellSort(array, n):</em>

<em>    # Rearrange elements at each n/2, n/4, n/8, ... intervals</em>

<em>    interval = n // 2</em>

<em>    while interval > 0:</em>

<em>        for i in range(interval, n):</em>

<em>            temp = array[i]</em>

<em>            j = i</em>

<em>            while j >= interval and array[j - interval] > temp:</em>

<em>                array[j] = array[j - interval]</em>

<em>                j -= interval</em>

<em>            array[j] = temp</em>

<em>        interval //= 2</em>

<em>data = [10,9,8,7,6,5,4,3,2,1]</em>

<em>size = len(data)</em>

<em>shellSort(data, size)</em>

<em>print('Sorted Array in Ascending Order:')</em>

<em>print(data)</em>

See more about python at brainly.com/question/18502436

#SPJ1

5 0
2 years ago
Write a python program to calculate the sum of three numbers and as well require the user to input the numbers.​
beks73 [17]

Answer:

numbers = []

for i in range(3):

 numbers.append(eval(input("Enter number: ")))

print('Sum is:', sum(numbers))

Explanation:

You want to use a loop to prevent repeating your code.

8 0
2 years ago
PLEASE ANSWER ASAP! THANKSSSSS
tankabanditka [31]
That is hard .....……
5 0
2 years ago
The link between violence in the media and school shootings has been proven to be direct. True/false?​
Sveta_85 [38]

Answer:

most of the time a school shooting will be done by a kis that has been bullied and picked on a lot (aka the quiet kid ) if we could stop bullying we could decreese the number of school shootins by a lot

Explanation:

8 0
3 years ago
The following code is poorly structured. Rewrite it so that it has a better structure and avoids redundancy. To help eliminate r
Virty [35]

Answer:

Explanation:

public static void main(String[] args) {

       Scanner console = new Scanner(System.in);

       spending(console,"John");  //calling spending method with "John"

       spending(console,"Jane");  //calling spending method with "Jane"

   }

   public static void spending(Scanner console, String name){

       System.out.print("How much will "+name+" be spending? ");

       double amount = console.nextDouble();

       System.out.println();

       int numBill = (int) (amount / 20.0);

       if (numBill * 20.0 < amount) {

           numBill++;

       }

       System.out.println("John needs " + numBill + " bills");

   }

Code Explanation

Method are reusable set of code which reduces redundancy. So the original code was trying to calculate the bill for John and Jane but the code to calculate was redundant which will cause more line of code and complex to manage. For example let say if we have 1000 of user to calculate there bill, will it be efficient to write bill calculation code for all 1000 users?

That's where function comes in to reduce redundancy from code and easy to manage.

Easy to Manage in a way, let say you need to change the bill calculation formula then without function, you have to change the formula for all the users but with function you only need to change the bill calculation formula in spending function.

7 0
3 years ago
Other questions:
  • When did Kodak introduce film photography to the commercial market?
    10·2 answers
  • The ____ shortcut keys remove character formatting. (points : 2) ctrl 0 (zero) ctrl i ctrl spacebar ctrl u
    8·2 answers
  • 20. Which of the following describes an acceptable print resolution?
    10·2 answers
  • Jackson builders is constructing new homes in the Parkway subdivision.The company needs the logic for an application that ncalls
    13·1 answer
  • A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
    13·2 answers
  • When activated, an Excel object has all the features of an Excel
    8·2 answers
  • The primary stream fed by tributaries within a dendritic drainage network is termed a ________ stream
    12·1 answer
  • Suppose that x = 1565.683, y = 85.78, and z = 123.982. What is the output of the following statements? cout &lt;&lt; fixed &lt;&
    8·1 answer
  • Explain how the internet works​
    7·2 answers
  • The famous arcade game Space Invaders was first adapted to which home console?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!