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
slamgirl [31]
3 years ago
6

Write function that ask for input from a user. Use this input as input for the countdown function that we wrote using the while

loop. If the user types 'end', the program exits, otherwise it keeps going.
Computers and Technology
1 answer:
Elza [17]3 years ago
3 0

Answer:

Written in Python:

def myfunction():

     userinput = input("User input: ")

     while(userinput != "end"):

           countdown(userinput)

           userinput = input("User input: ")

Explanation:

This line defines the function

def myfunction():

           This line prompts user for user input

           userinput = input("User input: ")

           The following while loop checks if userinput is not "end". It continues execution until user input "end"

           while(userinput != "end"):

                       countdown(userinput) If yes, the input is passed to the countdown function for execution

                       This line prompts user for another user input

                       userinput = input("User input: ")

<em>Please note the above code segment assumes that countdown() function has already been written and defined</em>

You might be interested in
Write a method named addCommas that accepts a string representing a number and returns a new string with a comma at every third
pentagon [3]

Answer:

Locale unaware

'{:,}'.format(value) # For Python ≥2.7

f'{value:,}' # For Python ≥3.6

Locale aware

import locale

locale.setlocale(locale.LC_ALL, '') # Use '' for auto, or force e.g. to 'en_US.UTF-8'

'{:n}'.format(value) # For Python ≥2.7

f'{value:n}' # For Python ≥3.6

6 0
3 years ago
My rank hasn't changed even though i've passed the point mark and i even tried to relogin but it still didn't change.
tatyana61 [14]
You need to wait, it isn't the website that ranks you, but actual people on the site. Just wait, have patience. 
5 0
3 years ago
Read 2 more answers
Why might a business professional choose to use a desktop computer rather than a tablet or laptop at work?
lawyer [7]
<h2>Laptops and Tablets are cool, classic, and have a business-y  vibe to them but Destop Computers are preferred because they're way more adaptable, have a lot of useful ports USB, SD, etc, and computer monitor vary a lot and anytime you want you can get one with lot's of RAM and Memory so that's very cool, and convenient of you're a businessman.</h2><h2>So what would I choose? I would probably choose A Laptop, but you know, it's business. :)</h2><h3>Good Luck on your Studies!</h3><h3>David Edward.</h3>
5 0
3 years ago
Read 2 more answers
Write a C++ program to find all numbersless than 1000 which are:
Elden [556K]

Answer:

The c++ program is shown below.

#include <iostream>

using namespace std;

int main() {    

   cout<<"Numbers less than 1000 which are divisible by 7"<<endl;    

   for(int k=1; k<1000; k++)

   {

       // number should give remainder 0 which show complete divisibility

       if(k%7 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%11 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 7 but not divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       // for 11, number should not give remainder 0 which shows incomplete divisibility

       if(k%7 == 0 && k%11 != 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 7 and divisible by 11"<<endl;

   

   for(int k=1; k<1000; k++)

   {

       if(k%7 == 0 && k%11 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are not divisible by 7 and not divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%7 != 0 && k%11 != 0)

           cout<<k<<"\t";

   }    

   return 0;

}

Explanation:

The test for divisibility is done by using the modulus operator which is used as a condition inside the if statement. This test is done inside for loop.

All the numbers from 1 to 999, less than 1000, are divided by 7 and/ or 11 depending on the sub question. Only the numbers which are completely divisible are displayed. Divisible numbers give remainder 0 always.

The divisibility test by 7 is shown below.

cout<<"Numbers less than 1000 divisible by 7"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%7 == 0)

           cout<<k<<"\t";

   }    

In other words, all the numbers divisible by 7 are same as the numbers in the table of 7.

The same logic shown above is applied for other sub questions to test for divisibility by 11 and combination of 7 and 11.

To improve readability, tabs and new lines are inserted at appropriate places.

8 0
3 years ago
Question 1<br> What does the % find?<br> The product<br> The mode<br> The quotient<br> The remainder
Paul [167]
The correct answer is the remainder
7 0
4 years ago
Other questions:
  • 30 POINTS PLEASE HURRY<br><br><br> How do you use information technology in your daily life?
    8·1 answer
  • A device that makes it possible for multiple customers to share one address is called a/n _____.
    15·1 answer
  • When do on loop conditions happen? (1 point)
    5·1 answer
  • Which one of the following terms is defined as the material and surfaces upon which an artist works?
    9·1 answer
  • Which spreadsheet operation does a look function perform?
    5·1 answer
  • Before you enable data deduplication, what tool can you use to determine if data deduplication would benefit the tested volumes
    11·1 answer
  • Debug the code in the main method of this class, which is intended to initialize an array named arr to hold 3 ints, fill this wi
    15·1 answer
  • Which function would you use to make sure all names are prepared for a mailing label? TODAY UPPER PROPER LOWER
    11·1 answer
  • Cual de las siguientes es una desventaja del uso de las computadoras?
    5·1 answer
  • joe is in the planning stages to make sure that an upcoming company promotion during a major sporting event will not overwhelm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!