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
gizmo_the_mogwai [7]
3 years ago
13

Please program this in Python.

Computers and Technology
1 answer:
Temka [501]3 years ago
5 0

lst = ["Star Wars", "Movie 2", "Movie 3", "Movie 4"]

print(lst[0])

I wrote my code in python 3.8. Best of luck

You might be interested in
For a list of numbers entered by the user and terminated by 0, find the sum of the positive number and the sum of the negative n
Katena32 [7]

Summarize all positive numbers as follows: + It's good. The total of all negative numbers is:, write it down. + Unfavorable.

<h3>What is C++ language?</h3>

C++ language is defined as a general-purpose programming language that supports procedural, object-oriented, and generic programming and is case-sensitive and free-form.  As well as being used for in-game programming, software engineering, data structures, and other things, C++ is also utilized to create browsers, operating systems, and applications.

An application that adds all positive integers and stores them in variables, as well as adding all negative numbers and storing them in variables. The software should print the values for both variables at the conclusion and compute their average. When the user enters a zero, the software should terminate.

Thus, summarize all positive numbers as follows: + It's good. The total of all negative numbers is:, write it down. + Unfavorable.

To learn more about C++ language, refer to the link below:

brainly.com/question/1516497

#SPJ1

8 0
1 year ago
Write a program that generates a random number between 5 and 15 and asks the user to guess what the number is. If the user’s gue
stepan [7]

Answer: The c++ program for the number guessing game is given below.

#include <iostream>

using namespace std;

// method declaration without parameters

void game();

int main() {    

char reply;

// calling the game method

game();  

cout<<"Would you like to continue with the game ? Enter y to continue. Enter q to quit the game. " <<endl;

cin>>reply;  

if(reply == 'y')

    game();      

if(reply == 'q')

    cout<<"Quitting the game..."<<endl;  

return 0;

}

void game()

{

   int num, guess, attempt=0;  

num = (rand() % 10) + 6;  

cout<<endl<<"Welcome to the game of guessing the correct number "<<endl;  

   do

{    

    cout<<"Enter any number between 5 and 15. "<< endl;

    cin>>guess;      

    if(guess<5 || guess>15)

    {

        do

        {

            cout<<"Invalid number. Enter any number between 5 and 15. "<<endl;

            cin>>guess;

        }while(guess<5 || guess>15);

    }  

    if(guess < num)

    {

        cout<<"Too Low"<<endl;

        attempt++;        

    }

    if(guess > num)

    {

        cout<<"Too High"<<endl;

        attempt++;          

    }      

}while(guess != num);  

cout<<"Congratulations. You figured out my number in "<<attempt<< " attempts."<<endl;

}

Explanation:

The expression

(rand() % 10)

generates a random number between 0 and 9. 6 is added to generate a random number between 5 and 15.

The integer variable attempt is initialized to 0.

Next, user is asked to guess the number. If the user enters an invalid input, the do-while loop begins until a valid input is received from the user.

    cout<<"Enter any number between 5 and 15. "<< endl;

    cin>>guess;      

    if(guess<5 || guess>15)

    {

        do

        {

            cout<<"Invalid number. Enter any number between 5 and 15. "<<endl;

            cin>>guess;

        }while(guess<5 || guess>15);

    }  

User is prompted to input the guess using the same do-while loop as above. Until the user guesses the correct number, the loop continues. Each incorrect guess by the user, increments the variable attempt by 1. This represents the number of attempts done by the user to guess the correct number.

    if(guess < num)

    {

        cout<<"Too Low"<<endl;

        attempt++;        

    }

    if(guess > num)

    {

        cout<<"Too High"<<endl;

        attempt++;          

    }  

The random number generation and the guessing logic is put in a separate method game().

The entry and exit from the game only is put inside the main method.

4 0
4 years ago
Why should you keep lines of code short?
Nataly [62]

The programmers should keep lines of code short because It makes the code more readable by other programmers.

<h3>Short lines of Code</h3>

Normally, a shorter lines of code are more efficient than spreading the code over several lines

Also, If a programmer have more lines of code, there are more places for bugs to hide and finding them might be more of a hassle.

So, the fewer lines of code can achieve the same results or much better than many lines of code

Hence, the programmers should keep lines of code short because It makes the code more readable by other programmers.

Therefore, the Option A is correct.

Read more about Short lines of Code

<em>brainly.com/question/20475581</em>

3 0
2 years ago
You have been studying processors. Your instructor has asked you to help prepare a lecture for introductory students learning ab
Svetlanka [38]

Answer:

Executing is the correct answer of the following question.

Explanation:

The ALU conducts data calculations, and is part of the system cycle execution process.Information and software engineering is the mechanism by which a software or digital machine conducts a computer program's instructions.The system instructions trigger patterns of basic acts at the performing computer.

Computer programs may be enacted in a cluster phase lacking direct human or a recipient-type instructions in an interpreter's collaborative process.

5 0
3 years ago
Which resources could be used a lot when installing a desktop app for synchronization purposes? Choose two answers.
Sergeu [11.5K]

Answer:

While installing desktop sync app such as drop box following two resources will be used a lot

  1. CPU
  2. RAM

Explanation:

CPU usage has been increased while installing desktop sync application, because it depends on the number of files that need to be synced. If the number of files is high the CPU usage will increase.

The need of memory such as RAM is also increased while installing the desktop sync application. As the number of files that need to be synced increases the RAM usage is also increases.

4 0
3 years ago
Other questions:
  • If the polar bear were taken out of the food chain what would happen to the seal population
    10·1 answer
  • A __________ network is good for connecting computers over boundaries.
    6·2 answers
  • Anna's computer has slowed down. How might she improve her computer's performance?
    6·1 answer
  • How you will install an operating system on your computer
    5·1 answer
  • During the conflict resolution process, which of the followings statements would be appropriate when defining the problem?
    11·2 answers
  • When Google created its China-based search engine www..cn, they did not foresee eventually abandoning it because of censorship i
    12·1 answer
  • The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two prec
    6·1 answer
  • The basics of color theory assume what central tenets
    14·1 answer
  • The sun emits invisible _____&gt; A) electromagnetic waves B) Waves C) Radiation D) Wavelength E) Ultraviolet Light
    8·1 answer
  • If you need to change the typeface of a document, which menu will you choose?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!