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

4. Write a program which selects two integer numbers randomly, adds the numbers and asks the user to enter the answer and then c

hecks if the answer is correct or not.
Computers and Technology
1 answer:
KIM [24]3 years ago
7 0

Answer:

import random

number1 = random.randrange(0, 1000)

number2 = random.randrange(0, 1000)

answer = int(input("Enter a number: "))

if answer == number1 + number2:

   print("Your answer is correct")

else:

   print("Your answer is not correct")

Explanation:

The code is in Python

Create two integer numbers using random

Ask the user for an input

Check if answer is equal to number1 + number2. If they are equal, print "answer is correct". Otherwise, print "answer is not correct".

You might be interested in
When using Microsoft word, what would happen to the text of a paragraph if the "Justify" option is used?
Bond [772]
Hello, and thank you for asking your question!

When you click on the 'Justify' option on any type of word pad, it'll make all lines of words perfectly aligned. Here is a quick few-sentence example I made. 
(Photo)

Hope this helps! ☺♥

3 0
3 years ago
The function below takes a single string parameter: sentence. Complete the function to return a list of strings indicating which
Katena32 [7]

Answer:

import java.util.*;

public class num3 {

   public static void main(String[] args) {

   String sentence = "All good people";

       System.out.println("The vowels in the sentence are ");

       returnVowels(sentence);

   }

   public static void returnVowels(String word){

       String newWord = word.toLowerCase();

       String vowels ="";

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

           if(newWord.charAt(i)=='a'||newWord.charAt(i)=='e'||newWord.charAt(i)==i||

           newWord.charAt(i)=='o'||newWord.charAt(i)=='u'){

               vowels = vowels+newWord.charAt(i);

               //System.out.print(newWord.charAt(i)+" ");

           }

       }

     

       String [] chars = vowels.split("");

       Set<String> uniqueVowels = new LinkedHashSet<>();

       for (String s : chars) {

           uniqueVowels.add(s);

       }

       System.out.println(uniqueVowels);

   }

}

Explanation:

In Java

Create the method/function to receive a string as argument

Change the string to all small letters using the toLowerMethod

Iterate through the string using if statement identify the vowels and store in a new String

Since the sentence does not contain unique vowel characters, use the set collections in java to extract the unique vowels and print out

7 0
3 years ago
list the six external parts of a computer system, identify which is the output device and which is the input device?
Mariulka [41]
1.mouse input
2.keyboard input
3.monitor output
4.speakers output
5.printer output , and input if has scanner
5.microphone input
4 0
4 years ago
Read 2 more answers
When using a NUMBERED list, you do not have to number each item. HTML automatically numbers each item in the order the items are
Oksi-84 [34.3K]

Answer:

hypertext markup language

Explanation:

i hope this helps, though im not sure weather your asking what HTML means, or a list of uses for HTML.

5 0
3 years ago
The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
lina2011 [118]
<span>C. Third phase of the Keynesian LRAS Curve.</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • Why we can't install a 64 bit software on a 32 bit computer??
    5·1 answer
  • write an algorithm that gets the price for item A plus the quantity purchased. The algorithm prints the total cost, including a
    5·1 answer
  • Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa
    5·1 answer
  • Logical address is generated by,
    13·1 answer
  • SimpleScalar is an architectural simulator which enables a study of how different pro-cessor and memory system parameters affect
    6·1 answer
  • What specific job usually includes the important pre-production step of making the
    12·1 answer
  • Test unit 8 edhesive answers ​
    15·1 answer
  • Why do we use the internet so much?​
    6·1 answer
  • How does the technology affect you daily living? Give situations where you use technology and how it helped you.​
    14·1 answer
  • Iris has completed a graphic design project for a client. what should iris obtain from the client in order to display the work i
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!