Question: python 2. [2] Use the code provided in the template to download the string which contains the first one million decimals of (thus, the string


2. [2] Use the code provided in the template to download the string which contains the first one million decimals of (thus, the string starts with 1415926535897932384). Write a function count_two which returns the list how many times, defined as how many times [j] the number of times the string j appears in the first one million decimals of , where j=00,01,02,..., 10, 11,..., 99. In other words: chop up -3 = .1415926535... 1058209... into two-digit numbers (with leading zero(s) included): 14, 41, 15. 59. 92. 26. 65, 53, 35,..., 10.05, 58, 82, 20, 09, and so on, and count how many times they appear. how many times [45] is equal to the number of times 45 appears in this list. Identify the two-digit string (number) that appears most often within the first one million decimals of , and the two-digit string (number) that appears least often. In each case, say how many times they appear. [Optional, not for credit: Print the list how_many times, and look at the values in it. What does this tell you about the distribution of two-digit numbers (from 00 to 99) within the decimals of ?) 59]: #Question 2 do not change this part import requests target_url="https://ms. mcmaster.ca/lovric/1MP3/files/piimillion, txt" response = requests.get(target_url) data_string = response. text = data string contains all 1 million digits data_string contains all 7 million digits, run to check its length: print(len (data_string) I def count_two 0: x=[] for i in range (0,9999, 2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
