def duplicate_digit_bonus (n): Some people ascribe deep significance to numerical coincidences, so that consecutive repeated đigits or other low description length patterns, such as a digital clock blinking 11:11, seem special and personal to them. Such people then find numbers with repeated digits to be more valuable and important than all the ordinary and pedestrian numbers without any obvious pattern. For example, getting inside a taxicab flashing an exciting number such as 1234 or 6969 would be far more instagrammable than a more pedestrian taxicab adorned with some dull number such as 1729. Assume that some such person assign a meaningfulness score to every positive integer so that every maximal block of k consecutive digits with k>1 scores 10** (k-2) points for that block. A block of two digits scores one point, three digits score ten points, four digits score a hundred points, and so on. However, just to make this more interesting, there is also a special rule in effect that if this block of digits is at the lowest end of the number, that block scores twice as many points as it would in any other position. Given a positive integer n>0, this function should compute and return its meaningfulness score as the sum of its individual block scores. Expected result 43333 200 2223 10

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
def duplicate_digit_bonus (n):
Some people ascribe deep significance to numerical coincidences, so that consecutive repeated
digits or other low description length patterns, such as a digital clock blinking 11:11, seem special
and personal to them. Such people then find numbers with repeated digits to be more valuable and
important than all the ordinary and pedestrian numbers without any obvious pattern. For example,
getting inside a taxicab flashing an exciting number such as 1234 or 6969 would be far more
instagrammable than a more pedestrian taxicab adorned with some dull number such as 1729.
Assume that some such person assign a meaningfulness score to every positive integer so that every
maximal block of k consecutive digits with k>1 scores 10** (k-2) points for that block. A block of
two digits scores one point, three digits score ten points, four digits score a hundred points, and so
on. However, just to make this more interesting, there is also a special rule in effect that if this block
of digits is at the lowest end of the number, that block scores twice as many points as it would in any
other position. Given a positive integer n>0, this function should compute and return its
meaningfulness score as the sum of its individual block scores.
Expected result
n
43333
200
2223
10
דד77דרררר
20000000
3888882277777731
11001
21
11747111117777700
12002
ןר9999997777
4488872222
21210
1234**5678
15418
Transcribed Image Text:def duplicate_digit_bonus (n): Some people ascribe deep significance to numerical coincidences, so that consecutive repeated digits or other low description length patterns, such as a digital clock blinking 11:11, seem special and personal to them. Such people then find numbers with repeated digits to be more valuable and important than all the ordinary and pedestrian numbers without any obvious pattern. For example, getting inside a taxicab flashing an exciting number such as 1234 or 6969 would be far more instagrammable than a more pedestrian taxicab adorned with some dull number such as 1729. Assume that some such person assign a meaningfulness score to every positive integer so that every maximal block of k consecutive digits with k>1 scores 10** (k-2) points for that block. A block of two digits scores one point, three digits score ten points, four digits score a hundred points, and so on. However, just to make this more interesting, there is also a special rule in effect that if this block of digits is at the lowest end of the number, that block scores twice as many points as it would in any other position. Given a positive integer n>0, this function should compute and return its meaningfulness score as the sum of its individual block scores. Expected result n 43333 200 2223 10 דד77דרררר 20000000 3888882277777731 11001 21 11747111117777700 12002 ןר9999997777 4488872222 21210 1234**5678 15418
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY