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
Elanso [62]
3 years ago
12

Can anyone tell me what wrong with this code the instructions are "Currently, this program will add 6 and 3 together, output the

math problem and output the answer. Edit this code so that a random number is generated from 1 - 10 (inclusive) for the variables a and b. Also, instead of adding the two numbers together, the edited program should multiply them, and output the proper math problem and answer. Be sure to update every line of code to reflect the changes needed." My code runs but it hasa EOF. My code is
import random
random.seed(1,10)
a = random.randint (1,10)
b = random.randint (1,10)
print ("What is: " + str(a) + " X " + str(b) + "?")

ans = int(input("Your answer: "))

if (a * b == ans):
print ("Correct!")
else:
print ("Incorrect!")
Computers and Technology
1 answer:
atroni [7]3 years ago
4 0

Answer:

import random

a = random.randint(1,10)

b = random.randint(1,10)

answer = a * b

print(str(b)+" * "+str(a)+" = "+str(answer))

Explanation: So I am guessing you are on Edhesive Module 2.5 Intro to cs. Sorry it took so long but hopefully this works.

You might be interested in
Write a program that prompts the user to enter in a postive number. Only accept positive numbers - if the user supplies a negati
marusya05 [52]

Answer:

The c++ program to check prime numbers is shown below.

#include <iostream>

using namespace std;

int main() {

   int num, prime=0;

   do

   {

       cout<<"Enter a positive number."<<endl;

       cin>>num;

       if(num<1)

       {

           cout<<"Invalid number. Enter a positive number"<<endl;

           cin>>num;

       }

   }while(num<1);

   

   if(num==1 || num==2 || num==3)

       cout<<num<<" is a prime number."<<endl;

   else if(num%2 == 0)

       cout<<num<<" is not a prime number."<<endl;

   else

   {

       for(int k=3; k<num/2; k++)

       {

           if(num%k == 0)

               prime++;

       }    

   if(prime>1)

       cout<<num<<" is not a prime number."<<endl;

   else

       cout<<num<<" is a prime number."<<endl;

   }

}

OUTPUT

Enter a positive number.

-7

Invalid number. Enter a positive number

0

Enter a positive number.

79

79 is a prime number.

Explanation:

The user input is validated for positivity. A do while loop along with an if statement is implemented for verification.

do

   {

       cout<<"Enter a positive number."<<endl;

       cin>>num;

       if(num<1)

       {

           cout<<"Invalid number. Enter a positive number"<<endl;

           cin>>num;

       }

   }while(num<1);

The test for prime number is done by using multiple if else statements.

If user inputs 1, 2, or 3, message is displayed.

Else If user inputs an even number, message is displayed for not prime. This is done by taking modulo of the number upon division by 2.

Else if user inputs neither an even number nor a number less than 3, the modulus of the number is taken with divisors beginning from 3 up to half of the input number.

For this, an integer variable prime is initialized to 0. A number can be completely divisible by itself or by its factors.

If the number is divisible by any of the divisors, value of variable prime is increased by 1. If value of prime is greater than 1, this means that the user input is divisible by more than one divisor. Hence, the given number is not a prime number.

5 0
3 years ago
Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output th
Lesechka [4]

Answer:

# FIXME (1): Prompt for four weights. Add all weights to a list. Output list.

weight_one=float(input('Enter weight 1:\n'))

weight_two=float(input('Enter weight 2:\n'))

weight_three=float(input('Enter weight 3:\n'))

weight_four=float(input('Enter weight 4:\n'))

weights=[weight_one,weight_two,weight_three,weight_four]

print(weights)

# FIXME (2): Output average of weights.

average_weight=(weight_one + weight_two + weight_three + weight_four) / 4

print('Average weight:', "%.2f" % average_weight)

# FIXME (3): Output max weight from list.

weights.sort()

max_weight= weights[3]

print('Max weight:', "%.2f" % max_weight)

# FIXME (4): Prompt the user for a list index and output that weight in pounds and kilograms.

print(input('Enter a list index location (0 - 3):'))

print('Weight in pounds:', weights)

kilograms = float(weights) * 2.2

print('Weight in kilograms:')

# FIXME (5): Sort the list and output it.

weights.sort()

print(weights)

Explanation:

6 0
3 years ago
A(n) ________ device facilitates file sharing and data backup.
wariber [46]
A NAS device facilitates file sharing and data backup.

NAS stands for "Network Attached Storage". It a device design specially to store and manage files and within a network. It provides centralized data access and storage.
NAS is somehow considered as a specialized external hard drive.
5 0
3 years ago
Read 2 more answers
ASAP Please Answer Question Within 5 Minutes! OSI is a reference system used by most types of technicians EXCEPT. Answer: Engine
likoan [24]

Answer:

Technical Illustrator do not use ISO reference model in their work. They often use graphical and visual drawing tools of technical illustration in their work. However, Network engineer and computer scientist  often used ISO reference model in their work. As you know that, ISO is a standard for protocol used for communication between two computers.

Explanation:

Technical Illustrator

A technical illustrator makes illustration and visual representation of a product in order to communicate technical information of technical nature with customer/user. The technical illustrator illustrates the technical presentation of the product in manuals and in publication. However, the technical illustrator doesn’t use the ISO model in their work. They use graphical and visual tools to help their work effectively.

Engineer:

Network engineers, communication and internet engineers use the ISO model. For example, if any fault occurs in LAN, to diagnose the fault, the network engineer uses the ISO model to identify the error in ISO layers. They use the ISO conceptual model, in order to know which layer is producing the fault.

Computer Scientists:

The computer scientist who is working in the field of telecommunication, they often use the ISO model as a base, to make improvement in the communication system and management of telecommunication system.

7 0
3 years ago
Read 2 more answers
When a program needs to save data for later use, it writes data to a _____?
lara [203]
It write data to a File
4 0
3 years ago
Other questions:
  • What are some measurements used to determine water waste from leaking faucets?
    10·1 answer
  • What laptops can you get for 2500$ and should mostly using Microsoft applications.
    14·2 answers
  • Hi weegy, what is the latest android os?
    9·1 answer
  • Choose the HTML5 element below that is used to configure an area on a web page that can stand on its own and could potentially b
    5·1 answer
  • A row in a table _____? for computer class and i’m in the middle of a test!
    14·1 answer
  • 4.15 LAB: Password modifier
    14·1 answer
  • What is the main difference between a peripheral device and other types of devices? Choose the best answer.
    12·1 answer
  • What is communication ????<br>​
    7·2 answers
  • Microsoft recommends when that you create passwords with upper and lowercase letters, numbers, symbols, and use at least _______
    5·1 answer
  • Which of the following can be termed ‘application software’?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!