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
MA_775_DIABLO [31]
4 years ago
7

The following code should take a number as input, multiply it by 8, and print the result. In line 2 of the code below, the * sym

bol represents multiplication. Fix the errors so that the code works correctly: input ("Enter a number: ") print (num * 8) The code above is pre-populated in your code editor. Hint: Remember that to think about the data type that the user will input. How can you make sure that their input is entered as a number?
Computers and Technology
1 answer:
Juli2301 [7.4K]4 years ago
6 0

Answer:

num = int(input("enter a number:"))

print(num * 8)

Explanation:

num is just a variable could be named anything you want.

if code was like this num = input("enter a number:")

and do a print(num * 8)

we get an error because whatever the user puts in input comes out a string.

we cast int() around our input() function to convert from string to integer.

therefore: num = int(input("enter a number:"))

will allow us to do  print(num * 8)

You might be interested in
Why coaxial cable is called coaxial cable?
lyudmila [28]

Answer: Coaxial Cable got its name as "coaxial cable" as it has two physical layer of channel in same cable axis.

Explanation: Coaxial cable is the cable that is basically composed of copper and shield of other materials.They have two physical channels and having a insulating layer between them and the outer layer serving as the ground layer. Both the channel of physical layer have the same axis that why it is termed as "coaxial".These cables are commonly used in the cable televisions , sometimes in telephone line etc.

3 0
3 years ago
what determines the best types of sketch or drawing to complete when you want to communicate your idea about a solution to a tec
Mekhanik [1.2K]
It depends on the problem. If you are solving a conplex one or simple
8 0
3 years ago
Translate the following MIPS code to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3
Romashka [77]

Answer:

f = 2 * (&A[0])

See explaination for the details.

Explanation:

The registers $s0, $s1, $s2, $s3, and $s4 have values of the variables f, g, h, i, and j respectively. The register $s6 stores the base address of the array A and the register $s7 stores the base address of the array B. The given MIPS code can be converted into the C code as follows:

The first instruction addi $t0, $s6, 4 adding 4 to the base address of the array A and stores it into the register $t0.

Explanation:

If 4 is added to the base address of the array A, then it becomes the address of the second element of the array A i.e., &A[1] and address of A[1] is stored into the register $t0.

C statement:

$t0 = $s6 + 4

$t0 = &A[1]

The second instruction add $t1, $s6, $0 adding the value of the register $0 i.e., 32 0’s to the base address of the array A and stores the result into the register $t1.

Explanation:

Adding 32 0’s into the base address of the array A does not change the base address. The base address of the array i.e., &A[0] is stored into the register $t1.

C statement:

$t1 = $s6 + $0

$t1 = $s6

$t1 = &A[0]

The third instruction sw $t1, 0($t0) stores the value of the register $t1 into the memory address (0 + $t0).

Explanation:

The register $t0 has the address of the second element of the array A (A[1]) and adding 0 to this address will make it to point to the second element of the array i.e., A[1].

C statement:

($t0 + 0) = A[1]

A[1] = $t1

A[1] = &A[0]

The fourth instruction lw $t0, 0($t0) load the value at the address ($t0 + 0) into the register $t0.

Explanation:

The memory address ($t0 + 0) has the value stored at the address of the second element of the array i.e., A[1] and it is loaded into the register $t0.

C statement:

$t0 = ($t0 + 0)

$t0 = A[1]

$t0 = &A[0]

The fifth instruction add $s0, $t1, $t0 adds the value of the registers $t1 and $t0 and stores the result into the register $s0.

Explanation:

The register $s0 has the value of the variable f. The addition of the values stored in the regsters $t0 and $t1 will be assigned to the variable f.

C statement:

$s0 = $t1 + $t0

$s0 = &A[0] + &A[0]

f = 2 * (&A[0])

The final C code corresponding to the MIPS code will be f = 2 * (&A[0]) or f = 2 * A where A is the base address of the array.

3 0
3 years ago
How to be like Elon Musk who achieved more in his 46 years than we will ever achieve in ten lifetimes?
kvasek [131]

Answer:

You can just be yourself?

4 0
3 years ago
Your manager asks you to get details on a computer crash. What Windows Administration Tool could you use?
Law Incorporation [45]
  • The answer is "Option C" because the WMD is a freeware memory test software that works excellently.
  • It is a comprehensive math question, and it is also quite straightforward to use.
  • They suggest that you first test your ram with Memtest86, but you really should always test a second time with a different memory testing application to be certain.
  • Microsoft Windows Diagnostic is the second tool, that scans your laptop's physical memory & identifies any faults.
  • It requires a reboot to be used the system that will restart, and you'll be unable to your mouse in the Memory Diagnostic Tool.

The wrong choices can be defined as follows:

  • In option a, it is wrong because the data warehouse transforms data into information that may be used by an organization's decision-making process.
  • In option b, it is wrong because by using Metrics Collector Groups and logging the data, it was able to display real-time market data as well as collect and store data.
  • In option d, it is wrong because this is a tool used in Windows, which displays detailed information about major events that have taken place on your machine.
  • In option e, it is wrong because messages and trace logs could be viewed and sorted using the Log Viewer.

Learn more:

Memory Diagnostic: brainly.com/question/13606234

3 0
3 years ago
Read 2 more answers
Other questions:
  • Write a C++ program that searches for anagrams in a dictionary. An anagram is a word obtained by scrambling the letters of some
    5·1 answer
  • An engine's _______ contains the cylinder block, the cylinders, the piston, the connecting rods, and the crankshaft assemblies.
    9·2 answers
  • WordArt styles allow you to add ____.
    9·1 answer
  • The local emergency manager has the responsibility for coordinating emergency management programs and activities. A local emerge
    7·1 answer
  • Kyle asked his supervisor which type of computing model was used when the enterprise first started. She explained that the organ
    14·1 answer
  • How do you change the name on your brainly account?
    12·1 answer
  • write the definition of a class clock. the class has no constructors and one instance variable of type int called hours.
    12·1 answer
  • 8. Ito ay paraan ng pagkuha ng kopya ng isang file mula sa isang website patungo sa file system. * 1 point A. Copyright B. Downl
    8·1 answer
  • To determine what to study one Should first
    7·1 answer
  • The output of a computer can be seen on ( monitor, keyboard or mouse )​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!