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
Paladinen [302]
3 years ago
14

Need 2.5 Code Practice Answers

Computers and Technology
2 answers:
konstantin123 [22]3 years ago
4 1

Answer:

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!")

Explanation:

iragen [17]3 years 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 for producing random numbers,random module has to be imported.
  • As mentioned in answer, random.seed() method is used to generate same random number again and again. Here we need to generate 2 different random numbers that is why we won't use this method.
  • To produce a random number, randint() method from random module is used. This method takes 2 parameters i.e. a low and high value. The low value is inclusive and the high value is exclusive. That is why , to get a number between [1,10], randint() takes 1 as low value(inclusive) and 11 as high value(exclusive).

Elo Lemon
3 years ago
This literally doesn’t work, I copy and pasted it into python and I get an EOD error when reading a line, help?!
You might be interested in
When you hear the word “stress” what does it mean to you? How does stress affect you and what do you do to cope with stress
stepan [7]

   Ways to Cope with  Stress

  • Re-balance Work and Home.
  • Build in Regular Exercise.
  • Eat Well and drink lots of water.
  • Connect with Supportive People.
  • Carve out Hobby Time.
  • Practice Meditation, Stress Reduction or Yoga.
  • Sleep Enough.
  • Bond with Your Pet.

 

hope it helps! :)

3 0
3 years ago
Evan is borrowing a friend's laptop to check out some groovy music files. What can Evan look for to quickly identify
Yuki888 [10]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct option for this question is the file extension. Because, by knowing the file extension, you can easily understand and know what the file is. If Evan checking out some groovy music files then he will definitely look at the file format to know that is it the music file or not.

Other options are not correct because:

messaging app function is to send the message, receive and store the message while hardware does not have any relation to identifying the music file and system software is an example of an operating system that also does not help the Evan for looking at music file on the laptop.

7 0
3 years ago
If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
mars1129 [50]

Answer:

def calculate_storage(filesize):

   block_size = 4096

   full_blocks = filesize // block_size

   partial_block = filesize % block_size

   if partial_block > 0:

       return (full_blocks + 1) * block_size

   return filesize

print(calculate_storage(1))

print(calculate_storage(4096))

print(calculate_storage(4097))

Explanation:

The python program defines the function 'calculate_storage' that calculates the block storage used. It gets the number of blocks used to store the data by making a floor division to get the integer value, then it checks for remaining spaces in the block. If there are spaces left, it adds one to the full_blocks variable and returns the result of the multiplication of the full_blocks and block_size variables.

8 0
3 years ago
What is the best AI app used in education?
goblinko [34]

Answer:

Khan Academy is the best app for education, you can watch videos and do quizes

5 0
3 years ago
FOR PYTHON 3
VLD [36.1K]

Answer:

Complete Python code with step by step comments for explanation are given below.

Python Code:

# creating a function named scrabble_number that will take num as input argument

def scrabble_number(num):

   # print the original number  

   print("The original number is: ",num)  

   # we can implement the required logic by using python built-in functions join() and zip()  

   scrambled = ''.join([char[1]+char[0] for char in zip(num[::2], num[1::2])])  

   # print the scrambled number

   print("The scrambled number is: " + str(scrambled))  

Driver code:

scrabble_number('123456')

Output:

The original number is: 123456

The scrambled number is: 214365

5 0
3 years ago
Other questions:
  • 1. An auto repair shop charges as follows. Inspecting the vehicle costs $75. If no work needs to be done,
    9·1 answer
  • Every time you are asked to work with others, you are being asked to:
    6·2 answers
  • Difference between a print device and a printer
    13·1 answer
  • When the hyper-v role is added to a windows server 2012 r2 server, what is loaded first during boot?
    6·1 answer
  • Your corporation hosts a Web site at the static public IP address 92.110.30.123.
    13·1 answer
  • What does this mean in python?
    5·1 answer
  • Which question is MOST important for an office to consider when upgrading to new software
    5·1 answer
  • What city, the major financial center of its country, is located on the northern coast of the island where the poet who wrote "A
    8·2 answers
  • Cú pháp câu lệnh xóa thủ tục
    12·1 answer
  • How could you represent the following binary color in hexadecimal? What is its numerical value? What color is it? How
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!