Python
programming exercise 5.5
in convert. py, define a function named re...
Computers and Technology, 03.12.2019 03:31 jholland03
Python
programming exercise 5.5
in convert. py, define a function named reptodecimal that expects two arguments, a string, and an integer. the second argument should be the base. for example, reptodecimal("10", 8) returns 8, whereas reptodecimal("10", 16) returns 16.
the function should use a lookup table to find the value of any digit. make sure that this table (it is actually a dictionary) is initialized before the function is defined.
for its keys, use the 10 decimal digits (all strings) and the letters a . . f (all uppercase). the value stored with each key should be the integer that the digit represents. (the letter a associates with the integer value 10, and so on.)
the main loop of the function should convert each digit to uppercase, look up its value in the table, and use this value in the computation.
include a main function that tests the conversion function with numbers in several bases.
an example of main and correct output is shown below:
def main():
print(reptodecimal('10', 10))
print(reptodecimal('10', 8))
print(reptodecimal('10', 2))
print(reptodecimal('10', 16))
10
8
2
16
Answers: 1
Computers and Technology, 22.06.2019 06:50, Mordred809
Type the correct answer in the box. spell all words correctly. which view of report creation allows you to customize the report before the database program creates it? creating a report in allows you to customize the report before the database program creates it. pl asap
Answers: 1
Computers and Technology, 24.06.2019 04:30, NEUROPHARMACOLOGICAL
The ieee 802.11: defines standards for wireless local area network (wlan) communication protocols. identifies various computers or devices connected to a network. verifies any resource attached to another computer on a network that is different from the computer to which the user is logged on. connects multiple local area networks (lans) and wide area networks (wans).
Answers: 2
English, 18.12.2020 08:00
Chemistry, 18.12.2020 08:00
Mathematics, 18.12.2020 08:00
Mathematics, 18.12.2020 08:00