Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python Binary Coded Decimal - Encoding Programming challenge description: Imagine that you are prototyping an electronic device based on the Arduino platform and you

in python
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Binary Coded Decimal - Encoding Programming challenge description: "Imagine that you are prototyping an electronic device based on the Arduino platform and you are using a seven-segment display to show numeric values. To reduce the number of used digital outputs of the microcontroller, the display board is connected to the main board through the integrated circuit of the decoder, which converts binary coded decimal (BCD) values to signals for the seven-segment display. So, to show any number on the display you need to set the required BCD code on the microcontroller's outputs. Write a program to convert an integer number represented as a string to a BCD code required for the display. In the BCD code, every decimal digit is encoded with its four-bit binary value. Encoding all digits of the decimal number and concatenating the resulting codes into one string you will get a resulting BCD code. A space is used to separate digits in the BCD So, to show any number on the disp.ay you need to set the required. BCD code on the microcontroller's outputs. Write a program to convert an integer number represented as a string to a BCD code required for the display. In the BCD code, every decimal digit is encoded with its four-bit binary value. Encoding all digits of the decimal number and concatenating the resulting codes into one string you will get a resulting BCD code. A space is used to separate digits in the BCD code and make it more readable. For example, a number 113 will be encoded to BCD as 2001 0111 0011 Input: Each line has a string representing a non- negative integer number. For example: 5 17 Output: Each line contains a BCD code of the number at the corresponding line of the input. Each une has a strng representing a non negative integer number. For example: 5 17 Output: Each line contains a BCD code of the number at the corresponding line of the input. Codes of the decimal digits are separated from each other with a space. For example: 0101 0001 0111 Test 1 Test Input 1 000 un Ernected. Outrust a 19 Test 2 Test Input 12 24 36 48 Expected Output 0001 0010 0010 0100 0011 0110 0100 1000 Test 3 Test Input 10 2567 16084222544 177824990519755121923 - Expected Output 2001 2000 0010 0101 0110 011- 0001 0110 0000 1000 01000010 0010 0010 0101 0100 0100 0001 0111 0111 1000 0010 0100 1001 1001 0000 0101 0001 1001 0111 0101 0101 0001 0010 0001 1001 0010 0011 Test 4 Test Input 01 009 Expected Output 0000 0001 0000 0000 1001

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

What are the potential benefits and problems with executive teams?

Answered: 1 week ago