answer.
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
ira
3 months ago
14

Need 2.5 Code Practice Answers

Computers and Technology
2 answers:
Natasha_Volkova [1K]3 months ago
4 1

Answer:

import random

random.seed(1,10) # Note: seed takes one argument, so this line has an error

a = random.randint(1, 10)

b = random.randint(1, 10)

print("Calculate: " + str(a) + " X " + str(b) + "?")

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

if ans == a * b:

print("Well done!")

else:

print("That's wrong!")

Explanation:

amid [951]3 months ago
3 1

Answer:

import random

#random.seed() should not be used here as this method will produce same number again and again

a = random.randint(1,11) #this method will generate random number between 1 and 10

b = random.randint(1,11)

print("What is: " + str(a) + " X " + str(b) + "?")

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

if (a * b == ans):

   print("Correct!")

else:

   print("Incorrect!")

Output :

What is: 8 X 5?

Your answer: 40

Correct!

Explanation:

  • First, the random module needs to be imported to generate random values.
  • The random.seed() function creates repeatable sequences, so it's avoided here to ensure different numbers each time.
  • The randint() method from the random module produces numbers within a specified range, inclusive of the lower bound and exclusive of the upper. Therefore, to get numbers from 1 to 10, the call is <code>randint(1,11)</code>.

You might be interested in
Henry, a graphic artist, wants to create posters. Which software should Henry use for this purpose?
ivann1987 [1066]

Answer:

which is free graphic software or use

Explanation:

3 0
2 months ago
The function below takes two numeric parameters. The first parameter specifies the number of hours a person worked and the secon
Harlamova29_29 [1022]

def calculate_pay(total_worked_hours, rate_per_hour):

   if total_worked_hours > 40:

       return (40 * rate_per_hour) + ((total_worked_hours - 40) * 2 * rate_per_hour)

   else:

       return total_worked_hours * rate_per_hour

Explanation:

The function calculate_pay is designed with two parameters.

  • Within the function, check if total_worked_hours exceed 40, then calculate the pay according to the overtime rules defined in the formula.
  • If not, simply return the pay by multiplying total_worked_hours with rate_per_hour.
6 0
1 month ago
Which of the following statements is true regarding input and output?
zubka84 [1067]
Input refers to the unprocessed data fed into a computer.
3 0
3 months ago
Read 2 more answers
Initialize the list short_names with strings 'Gus', 'Bob', and 'Zoe'. Sample output for the givenprogram:Gus Bob Zoeshort_names
maria [1035]

Answer:

short_names = ['Gus', 'Bob','Zoe']

Explanation:

In Python, a list is a data structure that permits the storage of various types of variables. Each element in a list has an indexed position, which must be an integer, and items can be accessed using their index. The syntax for creating and initializing a list is:

list_name = [item1, item2,item3]

  1. The name of the list (which must adhere to variable naming conventions)
  2. A pair of square brackets
  3. Items in the list must be separated by commas.

The Python code provided below demonstrates how to implement the solution to the stated problem:

short_names = ['Gus', 'Bob','Zoe']

print(short_names[0])

print(short_names[1])

print(short_names[2])

The output is:

Gus

Bob

Zoe

6 0
2 months ago
A have a string, called "joshs_diary", that is huge (there was a lot of drama in middle school). But I don't want every one to k
maria [1035]

Answer:

C and G

Explanation:

In the C programming language, the symbols ' * ' and ' & ' are utilized to create pointers and access references to those pointers, respectively. The ' * ' is used in conjunction with specific identifiers to define a pointer to a variable's location in memory, whereas the ' & ' is always positioned in front of a variable as an r_value for the specified pointer.

5 0
2 months ago
Other questions:
  • In what areas is Leslie's underspending hurting her budget select all that apply
    5·1 answer
  • A client is currently struggling with late-stage integration and manual deployments. They want to find another method that will
    5·1 answer
  • How concerned are you about the security of rtos in cars smart homes and wearable technology?
    15·1 answer
  • Write a statement that reads a floating point value from standard input into temperature. Assume that temperature. has already b
    6·1 answer
  • Ajay wants to read a brief overview about early settlers in the United States. Which type of online text source should he most l
    9·2 answers
  • 5.15 LAB: Output values below an amount Write a program that first gets a list of integers from input. The input begins with an
    9·2 answers
  • What are the set of rules to move data from one computer to another?
    11·1 answer
  • The ____________ protocol enables two users to establish a secret key using a public-key scheme based on discrete logarithms
    10·1 answer
  • Language levels have a direct influence on _______________
    10·1 answer
  • Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!