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
Gwar [14]
2 years ago
7

Hey guys. Can u help me pls? I need to add number1 and number2 together on Python, I don't know what I'm doing wrong. Thx for yo

ur help.

Computers and Technology
2 answers:
vovikov84 [41]2 years ago
5 0

You need to convert number1 and number2 into integer because input() function returns a string, not an integer. And the + operation with 2 strings variables will concatenate them. The correct answer is :

number1 = int(input('Enter number 1 : '))

number2 = int(input('Enter number 2 :'))

number3 = number1 + number2

print(number3)

Lilit [14]2 years ago
4 0

print(number1 + number2)

You might be interested in
Which education level has the highest return on investment (ROI)?
Keith_Richards [23]
The correct option is B.
Having a bachelor degree from a college gives the highest returns on investments. People who go to college usually secure high paying jobs compare to their counterparts who have less education.
The type of college one attends also matter, for instance in USA, the college in the first position, which gives the highest return on investment is Massachusetts Institute of Technology  [MIT].
5 0
3 years ago
Read 2 more answers
________ is a model of computing in which firms and individuals obtain computing power and software applications over the intern
Irina-Kira [14]
Pretty sure the answer is A.
4 0
2 years ago
Impact of computer in society, using relevant examples​
erica [24]
Computers have changed the way people relate to one another and their living environment, as well as how humans organize their work, their communities, and their time. Society, in turn, has influenced the development of computers through the needs people have for processing information.
3 0
2 years ago
Dentify the benefits of workplace diversity. Select all that apply.
soldier1979 [14.2K]

Answer:

Explanation:

slay ty

7 0
1 year ago
write a program that generates 100 random integrs between 0 and 9 and displays the count for each number. (Hint: Use (int) (math
Nataly_w [17]

Answer: The java program to generate 100 random numbers and count their occurrence is shown below.

import java.util.Random;

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

     int[]count = new int[10];

// temporarily stores the randomly generated number

     int num;

     for(int i=0; i<10; i++)

     {

// initialize count of all digits from 0 to 9 to zero

           count[i] = 0;

     }

     for(int i=0; i<100; i++)

     {

// generates 100 random numbers or integers from 0 through 9

           num = (int) (Math.random() * 10);

           for(int j=0; j<10; j++)

           {

// compare each randomly generated number with digits from 0 to 9 and increment their count accordingly

               if(num == j)

                   count[j] = count[j]+1;

           }

     }

     System.out.println("The count of randomly generated numbers is shown below.");

     for(int i=0; i<10; i++)

     {

           System.out.println("Count of "+i+" is "+ count[i]);

     }

   }

}

OUTPUT

The count of randomly generated numbers is shown below.

Count of 0 is 10

Count of 1 is 8

Count of 2 is 13

Count of 3 is 10

Count of 4 is 9

Count of 5 is 13

Count of 6 is 7

Count of 7 is 11

Count of 8 is 9

Count of 9 is 10

Explanation: This program declares an integer array of size 10 and initializes it to 0.

Random numbers are generated as shown. The number is randomly generated in an outer for loop with executes 100 times for 100 numbers.

(int) (Math.random() * 10)

The package java.util.Math is imported to serve the purpose.

The above code generates random numbers which can be floating numbers. The integer part is extracted using (int).

This yields the digits from 0 through 9.

For every occurrence of digits from 0 to 9, the count of the index of the respective digit is incremented.

To serve this purpose, inner for loop is implemented. The variable used in this loop is compared with the random number and index of count incremented accordingly. The inner for loop runs 10 times at the maximum, in order to match random number with 0 through 9.

Lastly, the occurrence of every digit from 0 to 9 is displayed.

8 0
3 years ago
Other questions:
  • Declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum
    9·1 answer
  • If in your checkout cart right before you buy something there is an option saying "this order contains a gift." on amazon, what
    7·1 answer
  • Insecurely attached infants who are left my their mothers in an unfamiliar setting often will
    14·1 answer
  • Convert the following pseudocode to C++ code. Be sure to define the appropriate variables. Store 25 in the speed variable. Store
    5·1 answer
  • Please help it would mean to world to me❤️ (WORD)
    13·1 answer
  • A local cinema allows customer to make a movie ticket reservation. A customer can be
    6·1 answer
  • My mom hid my laptop and now I can't find it​
    9·1 answer
  • What is the next line? &gt;&gt;&gt; myTuple = [10, 20, 50, 20, 20, 60] &gt;&gt;&gt; myTuple.index(50) 3 1 4 2
    14·2 answers
  • Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string
    14·1 answer
  • What is the output?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!