LANGUAGE IS PYTHON
9.8 LAB: Convert to binary

Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is:

As long as x is greater than 0
Output x modulo 2 (remainder is either 0 or 1)
Assign x with x divided by 2
Note: The above algorithm outputs the 0's and 1's in reverse order.

Ex: If the input is:

6
the output is:

011
6 in binary is 110; the algorithm outputs the bits in reverse.

Answers

Answer 1

The program illustrates the use of modulo operators

The modulo operator is used to return the remainder of a division.

The program in Python, where comments are used to explain each line is as follows:

#This imports the math module

import math

integer_value = int(input())

#This initializes the remainder to an empty string

remainder = ""

#This loop is repeated while the integer input is greater than or equal to 1

while integer_value>=1:

   #This calculates the remainder after the integer value is divided by 2

   remainder+=str(integer_value % 2)

   #This gets the floor division of the integer input by 2

   integer_value=math.floor(integer_value/2)

#This reverses the string

binary_equiv = remainder[::-1]

#This prints the binary equivalent

print(binary_equiv)

At the end of the program, the binary string is printed

Read more about similar programs at:

https://brainly.com/question/24742544


Related Questions

Of the following hard drives, which one is fastest?
a. SATA 6 Gb/s SSD
b. SATA 6 Gb/s 10,000-RPM drive
c. M.2 SSD using a SATA3 interface
d. PCIe NVMe SSD card

Answers

Answer:

D. PCIe NVMe SSD card

Explanation:

PCIe NVMe SSD cards are ludicrously fast even compared to some modern SSD drives today. Some can even average up to 8 GB/s while moving/copying files, though, the price tag is pretty high compared to some other SSD / HDD drives.

How many bits are in a single byte?

Answers

Answer:

8. One byte is 8 bits, 2 bytes is 16 bits, etc

Ms Excel is an example of______



Answers

Answer:

It is an example of a spreadsheet application

Explanation:

Ms Excel is an example of_spread sheet application_.

hope this helps you.

Which trait can be a positive or negative?

Answers

Answer:

Prejudice can be either positive or negative.

Implement a number guessing game where a player will get up to seven chances to guess a mystery number in the range of 1 through 100.

Answers

The implementation of the guessing game ls written in python 3 which involves a maximum guess of 7 to make a prediction of the random integer generated.

import random

#import the random module for generating random numbers

num = random.randint(0, 100)

#generate a random integer value between 1 to 100 and store in the variable num

tries = 0

#initialize a counter to record the number of guesses made

while tries <7 :

#while loop ensures that only a maximum of 7 guesses is are made

guess = int(input('Enter your guess'))

#prompts user to make a guess

tries+=1

#increases the number of guesses by 1

if guess == num :

#checks if the guess is equal to the random number

print('success')

#dispaly success if true

elif tries < 7 :

#if not check if number of guesses is not up to 7 and tell user to try again

print('Try again')

elif tries == 7 :

#checks if number of tries is equal to 7

print('tries exceeded\n the random number is :', num)

# tell user that is number of tries has elapsed and display the correct number.

A sample run of the program and the output is attached.

Learn more :https://brainly.com/question/19347842

Why did the spelling and grammar checkers in Word miss the errors highlighted in yellow?

Please help me

Answers

Answer:

Spelling and grammar missed them because the highlighted errors are actually words that are not in the right place and when you misspelled them, it turned into a word in the incorrect place.

Krista is doing research for her school assignment. While she is completing her research, the computer unexpectedly restarts. The computer restarted because it

was installing software
was installing updates
was updating the hardware
was updating the virus

Answers

Answer:

I believe the answer should be was installing updates.

Explanation:

the are the uncontrollable faces outside the business industry .​

Answers

Answer:

The uncontrollable risk factors are the details that affect the product that a company has no way of changing. These include political and economic climates, competitor choices and even the weather.

Explanation:

Which of the following correctly orders the steps involved in the outlining process?

brainstorm, order, organize, label
brainstorm, organize, order, label
organize, brainstorm, label, order
organize, brainstorm, order, label

Answers

Answer:

brainstorm, organize, order, label

Explanation:

The answer is:

brainstorm, organize, order, label

What is lhe correct sequence of Sprint Zero?
1. Estimate roughly
2. Form backlog
3. Setup environment
4. Define user stories

Answers

Answer:

Get some quality items on the Product Backlog

Product backlog for your credit bill nye is due for a week of

Which of the following is NOT an example of a computer? O Judge O ENIAC O Calculator O Abacus​

Answers

Answer:

Judge

Explanation:

ENIAC was the first programmable

Calculators are very simple electronic computers

Abacus are non-electronic computers

Judge is your answer

Name the major types of computer systems from slowest to fastest. ​

Answers

Answer:

Cache is the fastest and most expensive, RAM is slower and less expensive, and virtual memory is the slowest and least expensive type.

Explanation:

A mobile service provider has two data plans for its customers:

Silver plan: For $29.99 a month, 4 gigabytes are provided. Additional data costs $10 per gigabyte.
Gold plan: For $49.99 a month, 8 gigabytes are provided. Additional data costs $5 per gigabyte.

For both plans, the additional data is rounded up to an integral number of gigabytes. For example, if the additional data is 2.1 gigabytes, it is rounded up to 3 gigabytes, and the cost is $30 for the silver plan and $15 for the gold plan. Write a program that displays a menu of choices.

Answers

The program is an illustration of built-in functions and conditional statements.

Built-in functions are functions that have specific roles defined in them, while conditional statements are statements whose execution depends on the truth values of the condition.

The program in Python, where comments are used to explain each line is as follows:

import math

#This prints the menu

print("Menu\n1.- Silver plan\n2. Gold plan")

#This gets input for the plan from the user

selection = int(input("Select a plan: "))

#This gets the additional data from the user

additional_data = float(input("Additional data: "))

#This rounds up the additional data to the next integer

additional_data = math.ceil(additional_data)

#If selection is 1

if selection == 1:

   #This calculates the additional cost and the total cost

   additional_cost = 10 * additional_data

   total = additional_cost + 29.99

#If selection is 2

elif selection == 2:

   #This calculates the additional cost and the total cost

   additional_cost = 5 * additional_data

   total = additional_cost + 49.99

#For other inputs, the selection is considered invalid

else:

   print("Invalid selection")

#This prints the additional and the total costs, for selections 1 and 2

if selection == 1 or selection == 2:

   print("Additional cost:",additional_cost)

   print("Total cost: {:.2f}".format(total))

At the end of the program, the appropriate costs are printed for valid selections.

Read more about similar programs at:

https://brainly.com/question/25210352

give atleast 5 example of ENFRAMING in our daily lives

Answers

Answer:

1. steel is produced to be used in such things as the production of automobiles, and, although steel is not the automobile, it is, nevertheless, affected by the “coming into being” of the automobile.

Steel is produced to be used in such things as the production of automobiles, and, although steel is not the automobile, it is, nevertheless, affected by the “coming into being” of the automobile.

What is Automobile?

The first steam-powered vehicle was created in 1672, marking the beginning of the development of the car. Nicolas-Joseph Cugnot produced the first steam-powered automotive that could transport people in 1769.

Around the beginning of the 19th century, inventors started to take risks and developed the de Rivas engine, one of the first internal combustion engines, and an early electric motor. The Volkswagen Beetle and the Ford Model T are two of the most widely produced car models in history, respectively.

A backlash against huge vehicles in the middle of the 19th century slowed development, but certain internal combustion engines nevertheless advanced.

Therefore, Steel is produced to be used in such things as the production of automobiles, and, although steel is not the automobile, it is, nevertheless, affected by the “coming into being” of the automobile.

To learn more about automobile, refer to the link:

https://brainly.com/question/1193772

#SPJ2

Which kind of devices uses radio waves to transport data? devices use radio waves to transport data.

Answers

Answer:

In computer networking, RF is used to describe network devices (hubs, bridges, etc.) that transmit data signals using radio waves instead of data cables or telephone lines.

Explanation:

Answer:

In computer networking, RF is used to describe network devices (hubs, bridges, etc.) that transmit data signals using radio waves instead of data cables or telephone lines.

Explanation:

Answer this pls ASAP

Answers

Answer:

I'm not going to answer it just because you said "ASAP" never rush an intellectual such as ME.

How large are the laptop discounts for Black Friday?

Answers

Answer:

i dont know you can look it up in gogle

Explanation:

Answer: Some about 50% off, some 30% off.

What are some good predictions for video games in 2030? I need good reliable sources that have timestamps, like they say 2030 in them. Thank you!

Answers

Answer:

The 2021 global games market will generate revenues of $175.8 billion and is projected to exceed $200 billion by the end of 2023, according to a report by Newzoo (via VentureBeat). More than half of these revenues will come from mobile gaming, the largest segment of the marke

Explanation:

hope it's helpful to you

A partition is the _____.


an application that makes an operating system easier to use, also known as a shell

section of a hard drive

the core of an operating system that controls the basic functions

software that can be downloaded from the Internet at no cost

Answers

A partition is a section of a storage device

choose the missing term
-------time
time.sleep(3)

Answers

Answer:

import

Explanation:

If this is python, you'll have to import the time module.

Write the types of computer viruses.​

Answers

File infecting virus, web scripting virus, resident virus browser hijacker

10 shortcuts in word processing

Answers

Answer:

Word shortcut keys

Ctrl + A -- Select all contents of the page.

Ctrl + B -- Bold highlighted selection.

Ctrl + C -- Copy selected text.

Ctrl + X -- Cut selected text.

Ctrl + N -- Open new/blank document.

Ctrl + O -- Open options.

Ctrl + P -- Open the print window.

Ctrl + F -- Open find box.

Answer:

Ctrl + A -- Select all contents of the page.

Ctrl + B -- Bold highlighted selection.

Ctrl + C -- Copy selected text.

Ctrl + X -- Cut selected text.

Ctrl + N -- Open new/blank document.

Ctrl + O -- Open options.

Ctrl + P -- Open the print window.

Ctrl + F -- Open find box.

Explanation:

What is lhe correct sequence of determining and development of CRM strategies?
1. Amplify commitment
2. Building valuable project team
3. Requirement analysis

Answers

Answer:

Plugins

API Docs

Find an Expert

Sendinblue Academy

Customer Stories

Premium Templates

Product Updates

Become a Sendinblue Expert

Sign up free

Log in

September 21, 2020

8 Steps to Creating a CRM Strategy for Your Business

Reading time about 9 min

What is a CRM strategy?

A Customer Relationship Management strategy is a plan to grow sales and improve customer service through a combination of processes, actions, and technology. It typically involves the sales, marketing, and customer service functions of a business.

What was once the traditional buyer-seller model has shifted from transactional to customer-centric. Customer relationships today require higher levels of maintenance, which is why businesses now have entire CRM strategies dedicated to managing them.

One of the reasons is that consumers have bigger expectations than ever when it comes to customer service. They’re not going to think twice about going elsewhere if yours isn’t up to scratch.

When we hear the words ‘CRM strategy’, we’re inclined to think about CRM software. But software is only one piece of a much larger puzzle.

The best customer relationship management strategy incorporates both people and software.

Stay tuned for our comprehensive 8-step guide to developing a CRM strategy for your business.

sorry if i dont help you

What is computer Write three features of computer ​

Answers

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs. These programs enable computers to perform a wide range of tasks.

speed, accuracy, diligence, versatility and storage capacity

A computer is a machine that can be programmed to manipulate symbols. Its principal characteristics are: It responds to a specific set of instructions in a well-defined manner. It can execute a prerecorded list of instructions (a program). It can quickly store and retrieve large amounts of data.

The characteristics of computers that have made them so powerful and universally useful are speed, accuracy, diligence, versatility and storage capacity.

[C++] 4.17 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH

Answers

The program illustrates the use of string manipulations.

String manipulation involves carrying out several operations (such as splitting and reversing of strings).

The program in C++ where comments are used to explain each line is as follows:

#include <bits/stdc++.h>

using namespace std;

int main(){

   //This declares a string variable

string str;

//This gets input for the variable

getline(cin, str);

//The following is repeated, until the user inputs "Done", "done" or "d"

while(str != "Done" && str !="done" && str !="d"){

    //This reverses the string

    reverse(str.begin(), str.end());

    //This prints the reversed string

    cout << str<<endl;

    //This gets another input

    getline(cin, str);

}  

return 0;

}

At the end of each loop, the reversed string is printed.

See attachment for sample run

Learn more about similar programs at:

https://brainly.com/question/24833629

cách soạn thảo văn bản trên word

Answers

Answer:

Did you mean How to edit text on word? There are 2 word, Microsoft Word Office and WordPad. The step I give you below is for both.

Explanation:

Steps to edit text on word

Step-1: Select the text you want to edit.

Step-2: Click on Home Tab.

Step-3: Select the style(s) you want to edit from the Font group

2. What does the menu system on your DVD player illustrate?
(1 point)
O interface
O link
O menu system
O search engine

Answers

Answer:

Interface, (A)

Explanation:

Because it just does

interface

the correct answe

major developments in 5th generation computers?​

Answers

Answer:

ULSI technology.

Development of true artificial intelligence.

Development of Natural language processing.

Advancement in Parallel Processing.

Advancement in Superconductor technology.

More user-friendly interfaces with multimedia features.

Availability of very powerful and compact computers at cheaper rates.

Explanation:

c program how to input this? ​

Answers

Chchvjvcuvggiiog. Correct

[tex]\huge \boxed{\sf code}[/tex]

#include <stdio.h>

int  main() {

       // Declare the variables

       float a,b,c,d,e;

       float sum;

       // Ask the user to input

       printf("Enter the first number: ");

       scanf("%f",&a);

       printf("Enter the second number: ");

       scanf("%f",&b);

       printf("Enter the third number: ");

       scanf("%f",&c);

       printf("Enter the fourth number: ");

       scanf("%f",&d);

       printf("Enter the fifth number: ");

       scanf("%f",&e);

       // Use if statements to calculate the sum

       if (a < 0) {

               sum = sum + a;

       }

       if (b < 0) {

               sum = sum + b;

       }

       if (c < 0) {

               sum = sum + c;

       }

       if (d < 0) {

               sum = sum + d;

       }

       if (e < 0) {

               sum = sum + e;

       }

       // Print the sum

       printf("Sum of all negative integers = %.2f\n", sum);

       // Return an integer

       return 0;

}

[tex]\Large \boxed{\sf explanation}[/tex]

Declare the variables a, b, c, d, e, and sum as float type.

Display to the user to ask for input and take the input.

Use if statements to determine if a, b, c, d, and e are less than 0. If yes, then add them to the sum. If no, then skip to the following function.

Print the sum as a float type with 2 decimal points.

Return an integer.

Where is the ‘Chart’ button in Powerpoint?

Answers

Answer:

The picture attached

Other Questions
juan compro: 1/4 de pepino que cuesta $3, 1 1/2 de jamn que cuesta $120, 1/3 de tortillas que cuesta $6, 4/8 de queso que cuesta $45. cuanto dinero gasto en total? cuanto cuesta un kilo de queso? cuanto cuesta medio kilo de jamn? Cunto gastara si comprara un kilo de tortilla, un kilo de pepino, y un kilo de jamn? si Juan tiene $430 que puede comprar sin que le sobre ni un peso? did someone hang themselves on the wizard of oz set What was the place and role of women in revolutionary society and how they felt about their own rights within the new american republic ( as told by Hamilton's sister-in-law Angelica Schuyler in the song " Satisfied")? Which statement below would Oscar Pistorius, the athlete hoping to compete in the Olympics using prosthetic legs,most likely agree with?a. Prosthetic legs are not an unfair advantage c. Utilizing advanced technology, such as altitudein a race.tents and prosthetic limbs would give someathletes and unfair advantage.b. Technologically enhanced athletes should d. Oscar Pistorius would likely agree with all ofcompete in their own races.these statements. help asap please, this is due in 30 minutes.2. Write and evaluate a subtraction expression to find the depth of the submersible at 2:17pm.3. Write and evaluate a subtraction expression to find the depth of the submersible at 2:18pm.4. if the submersible dove straight down, what is the distance between the submersibles starting position at 2:15 and its position at 2:18? Show your work. Millie and Mollys ages add up to 19 years Millie is three years older than Molly how old are they help me please im stuck on this Multiply. Write the answer in simplest form. 1 3/101/8 A bottle contains liters of soda. Henry has 12 of these bottles.How much soda does he have in all?Write your answer in simplest form. What is 7054.72 rounded to the nearest 10? 42 43 45 ? 52 23 ? 33 38 43Find the question marks Find the acute angles of a right triangle if:A) one of them is 60 higher than the other;B) one of them 2 timesC) The ratio of their values is 2:3.help!!!!!!!!!hurry up please and tell me about everything pleasecan someone help me im gonna be late pleasee do it for me my mom gonna kill me if i will got f Thethe unemployment rate, theworse the economy.A. lowerB. higherC. more stagnant 100 POINTS FOR THIS!!! which food provides the best source of the recommended daily allowance for fats? Determine the x and y intercepts of the graph of 3x + 4y = 24 Which sentence best states the conflict revealed in this passage from HelenKeller's The Story of My Life?Have you ever been at sea in a dense fog, when it seemedas if a tangible white darkness shut you in, and the greatship, tense and anxious, groped her way toward the shorewith plummet and sounding-line, and you waited withbeating heart for something to happen? I was like that shipbefore my education began, only I was without compass orsounding-line, and had no way of knowing how near theharbour was. "Light! give me light!" was the wordless cry ofmy soul, and the light of love shone on me in that veryhour.A. Helen is scared that she will never be able to communicate withher family again.B. Helen is angry that her mother and teacher aren't helping her tocommunicateC. Helen is frustrated by the challenges associated with learning tocommunicateD. Helen is sad that her teacher is leaving and will be unable tocommunicate with her. Its going to be Lindsays birthday soon and her 5 friends Mary Jacqui Tadeusz opal and Tony have contributed equal amounts of money to buy her a present. They have $45.00 to spend between them. Determine how much each contributedA. 5y = $45.00; y = $9.00B. 5y = $45.00; y = $10.00C. 5 + y = $45.00; y = $39.00D. 5 + y = $45.00; y = $40.00 Please help me!READING SKILS Solve for x-4 < or equal to 16 - 4x