Octal numbers have a base of eight and the digits 0-7. Write the scripts octalToDecimal.py and decimalToOctalpy, which convert numbers between the octal and decimal representations of integers. These scripts use algorithms that are similar to those of the binary ToDecimal and decimal ToBinary scripts developed in the Section: Strings and Number Systems. An example of octalToDecimalpy input and output is shown below: Enter a string of octal digits: 234 The integer value is 156 An example of decimalToOctal,py input and output is shown below: Enter a decimal integer: 27 Quotient Remainder Octal 3 3 3 0 3 33 The octal representation is 33

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Octal numbers have a base of eight and the digits 0-7. Write the scripts octalToDecimal.py and decimalToOctalpy, which convert numbers between the octal and decimal representations of integers. These scripts use algorithms that are similar to those of the binary ToDecimal and decimal ToBinary scripts developed in the Section: Strings and Number Systems. An example of octalToDecimalpy input and output is shown below: Enter a string of octal digits: 234 The integer value is 156 An example of decimalToOctal,py input and output is shown below: Enter a decimal integer: 27 Quotient Remainder Octal 3 3 3 0 3 33 The octal representation is 33
déploymentld%3D6033602226691939025141989724&elSBN=9780357505397&id%3D13765636788snapshotld=2741191&
* CENGAGE MINDTAP
Programming Exercise 4.4
Instructions
binaryToDeci.
decimalToBin..
decimalToOct. octalToDecim.
>- Termin.
Octal numbers have a base of eight and the digits 0–7. Write the scripts octalToDecimal.py and
2 File: decimalToOctal.py
3 Converts a decimal integer to a octal integer.
decimalToOctal.py, which convert numbers between the octal and decimal representations of
4
5 # Request
6 decimal=int(input('Enter a decimal integer:'))
7 print("\nQoutient Remainder Octal")
8 #Variables
integers.
</>
These scripts use algorithms that are similar to those of the binaryToDecimal and decimalToBinary
scripts developed in the Section: Strings and Number Systems.
9 i=1
10 octalNum=0
An example of octalToDecimal.py input and output is shown below:
11 num=""
12 #Loop
13 while(decimal !=0):
14 # to find remainder
Enter a string of octal digits: 234
15
rm=decimal % 8
16 decimal//=8
17 octalNum=octalNum+rm*i
18 i*=10
19 num=str(rm)+num
20 print("%5d%8d%12s" %(decimal, rm,num))
21 #print
22 print( The octal representation is', octalNum)
23
The integer value is 156
An example of decimalToOctal.py input and output is shown below:
Enter a decimal integer: 27
24
Quotient Remainder Octal
25 File: octalToDecimal.py
3
3
26 converts a octal integer to a decimal integer
27
3
33
28 #input
The octal representation is 33
29 octalNum=int (input('Enter a string of octal digits:
30 #required variables
31 i=1
Grading
32 decimal=D0
33 #loop for conversion
34 while(octalNum !=0):
When you have completed your program, click the Submit button to record your score.
35 #To find remainder
36 rmd=octalNum %10
37 octal Num//=10
62°F Mostly s
Transcribed Image Text:déploymentld%3D6033602226691939025141989724&elSBN=9780357505397&id%3D13765636788snapshotld=2741191& * CENGAGE MINDTAP Programming Exercise 4.4 Instructions binaryToDeci. decimalToBin.. decimalToOct. octalToDecim. >- Termin. Octal numbers have a base of eight and the digits 0–7. Write the scripts octalToDecimal.py and 2 File: decimalToOctal.py 3 Converts a decimal integer to a octal integer. decimalToOctal.py, which convert numbers between the octal and decimal representations of 4 5 # Request 6 decimal=int(input('Enter a decimal integer:')) 7 print("\nQoutient Remainder Octal") 8 #Variables integers. </> These scripts use algorithms that are similar to those of the binaryToDecimal and decimalToBinary scripts developed in the Section: Strings and Number Systems. 9 i=1 10 octalNum=0 An example of octalToDecimal.py input and output is shown below: 11 num="" 12 #Loop 13 while(decimal !=0): 14 # to find remainder Enter a string of octal digits: 234 15 rm=decimal % 8 16 decimal//=8 17 octalNum=octalNum+rm*i 18 i*=10 19 num=str(rm)+num 20 print("%5d%8d%12s" %(decimal, rm,num)) 21 #print 22 print( The octal representation is', octalNum) 23 The integer value is 156 An example of decimalToOctal.py input and output is shown below: Enter a decimal integer: 27 24 Quotient Remainder Octal 25 File: octalToDecimal.py 3 3 26 converts a octal integer to a decimal integer 27 3 33 28 #input The octal representation is 33 29 octalNum=int (input('Enter a string of octal digits: 30 #required variables 31 i=1 Grading 32 decimal=D0 33 #loop for conversion 34 while(octalNum !=0): When you have completed your program, click the Submit button to record your score. 35 #To find remainder 36 rmd=octalNum %10 37 octal Num//=10 62°F Mostly s
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education