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
kotykmax [81]
3 years ago
7

What is a Forloop and what is it used for?

Computers and Technology
2 answers:
anastassius [24]3 years ago
6 0
It is used to repeat any block of code multiple times (iteration)
murzikaleks [220]3 years ago
4 0

Answer:

A "For" Loop is used to repeat a specific block of code a known number of times. For example, if we want to check the grade of every student in the class, we loop from 1 to that number.

Explanation:

You might be interested in
Raul in Colombia can enter data into a spreadsheet. Olivia in England can access the spreadsheet a few minutes later and use Rau
Mila [183]

True, as long as the application is a cloud-based spreadsheet (like Google Docs or MS Office 365), which allows multiple users in any location to view or edit the data with proper access permissions.

7 0
2 years ago
An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, AGH i
gregori [183]

Answer:

Here is the Python program:

#the method acronym that takes an argument phrase

def acronym(phrases):  

   acronym = ""  #to store acronym of a phrase

#loop to split the input phrase and return its acronym in upper case letters

   for phrase in phrases.split():  

       acronym = acronym + phrase[0].upper()

   return acronym

#main function that takes input phrase from user and display its acronym

def main():

   phrases = input("Enter a phrase: ")

   print("The acronym for your phrase is ",acronym(phrases))

main()

Explanation:

First let me explain the method acronym. This method takes a parameter phrase to return its corresponding acronym. First the phrase is split using split() method which is used to return the list of words in a phrase. For loop is used that will keep splitting the words in the string (phrase) entered by the user.

In this statement: acronym = acronym + phrase[0].upper()  the acronym is computed. phrase[0] means the first character of each word in the phrase which is found out by the split() method is converted to upper case by using upper() function and then stored in acronym variable. Each time the acronym is found and its first character is converted to upper case and added to the acronym variable.

Then the main() function prompts the user to enter a phrase and then calls the acronym function and passed that phrase as parameter to that function. Then the computed acronym for the phrase is printed on the screen.

7 0
3 years ago
Firefox, Chrome, Opera, and Safari are examples of
MrRissso [65]
D. Browsers

You're on one right now! :)

3 0
3 years ago
2.36 LAB: Warm up: Variables, input, and casting (1) Prompt the user to input an integer, a double, a character, and a string, s
Westkost [7]

Answer:

The entire program is:

#include <iostream>

using namespace std;

  int main() {          

  int userInt;

  double userDouble;

  char userChar;

  string userString;  

  cout<<"Enter integer:"<<endl;

  cin>>userInt;  

  cout<<"Enter double:"<<endl;

  cin>>userDouble;  

  cout<<"Enter character:"<<endl;

  cin>>userChar;  

  cout<<"Enter string:"<<endl;

  cin>>userString;    

 cout<<userInt<<" "<<userDouble<<" "<<userChar<<" "<<userString<<endl;

 cout<<endl;  

   cout<<userInt<<" "<<userDouble<<" "<<userChar<<" "<<userString<<endl<<userString<<" "<<userChar<<" "<<userDouble<<" "<<userInt<<endl;  

cout<<endl;

cout<<userInt<<" "<<userDouble<<" "<<userChar<<" "<<userString<<endl<<userString<<" "<<userChar<<" "<<userDouble<<" "<<userInt<<endl<<userDouble<<" cast to an integer is "<<(int)userDouble;  

  return 0;  }

The program in C language:

#include <stdio.h>  

int main() {

  int userInt;  

  double userDouble;  

  char userChar;  

  char userString[50];

  printf("Enter integer: \n");  

  scanf("%d", &userInt);

  printf("Enter double: \n");  

  scanf("%lf", &userDouble);

  printf("Enter character: \n");  

  scanf(" %c", &userChar);  

  printf("Enter string: \n");  

  scanf("%s", userString);  

  printf("%d %lf %c %s\n", userInt, userDouble, userChar, userString);

  printf("\n");

  printf("%d %lf %c %s\n%s %c %lf %d \n", userInt, userDouble, userChar, userString, userString, userChar, userDouble, userInt);

  printf("\n");

  printf("%d %lf %c %s\n%s %c %lf %d\n%lf cast to an integer is %d \n", userInt, userDouble, userChar, userString, userString, userChar, userDouble, userInt, userDouble, (int)userDouble);  }

Explanation:

Lets do the program step by step:

1)  Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space:

Solution:

The program is:

#include <iostream>  //to use input output functions

using namespace std;  //to identify objects cin cout

  int main() {  //start of main method

  //declare an integer, a double, a character and a string variable  

  int userInt;  //int type variable to store integer

  double userDouble;  //double type variable to store double precision floating point number

  char userChar;  //char type variable to store character

  string userString;  //string type variable to store a string

  cout<<"Enter integer:"<<endl;  //prompts user to enter an integer

  cin>>userInt;  //reads the input integer and store it to userInt variable

  cout<<"Enter double:"<<endl;  //prompts user to enter a double type value

  cin>>userDouble;  //reads the input double value and store it to userDouble variable

  cout<<"Enter character:"<<endl;  //prompts user to enter a character

 cin>>userChar; //reads the input character and store it to userChar variable

  cout<<"Enter string:"<<endl;  //prompts user to enter a string

  cin>>userString; //reads the input string and store it to userString variable

   

cout<<userInt<<" "<<userDouble<<" "<<userChar<<" "<<userString<<endl; //output the values on a single line separated by space

So the output of the entire program is:

Enter integer:                                                                                                                                99                                                                                                                                            Enter double:                                                                                                                                 3.77                                                                                                                                          Enter character:                                                                                                                              z                                                                                                                                             Enter string:                                                                                                                                 Howdy                                                                                                                                         99 3.77 z Howdy

(2) Extend to also output in reverse.

Now the above code remains the same but add this output (cout) statement at the end:

  cout<<userString<<" "<<userChar<<" "<<userDouble<<" "<<userInt;

Now the output with the same values given as input is:

Enter integer:                                                                                                                                  99                                                                                                                                              Enter double:                                                                                                                                   3.77                                                                                                                                            Enter character:                                                                                                                                z                                                                                                                                               Enter string:                                                                                                                                   Howdy  

99 3.77 z Howdy                                                                                                                                     Howdy z 3.77 99

(3) Extend to cast the double to an integer, and output that integer.

The rest of the code remains the same but add the following output (cout) statement in the end:

cout<<userDouble<<" cast to an integer is "<<(int)userDouble;

Now the output with the same values given as input is:

Enter integer:                                                                                                                                  99                                                                                                                                              Enter double:                                                                                                                                   3.77                                                                                                                                            Enter character:                                                                                                                                z                                                                                                                                               Enter string:                                                                                                                                   Howdy                                                                                                                                           99 3.77 z Howdy                                                                                                                                 Howdy z 3.77 99                                                                                                                                 3.77 cast to an integer is 3  

3 0
3 years ago
15
iVinArrow [24]

I believe that the answer is A: Extension but I am not 100% sure, hope this helps.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Which Command Prompt commands in Windows is used for listing a computer connections to shared resources
    10·1 answer
  • What is one visual indication that a usb port can be used to charge a mobile device?
    13·1 answer
  • Desktop computer systems are less reliable than laptop computers. <br> a. True <br> b. False
    9·1 answer
  • Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
    11·1 answer
  • 1. What is Java SE?
    11·2 answers
  • The ____ aggregate function finds the largest value
    10·1 answer
  • The computer program that Josh is working on presents him with a sentence in which a word has been underlined. Josh has to indic
    9·1 answer
  • Computer programming 3
    13·1 answer
  • Write the definition of a function that evaluates three double numbers and returns true if the floor of the product of the first
    8·1 answer
  • What are some of the most common obstacles in video games?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!