在此处输入图像描述
嗨,我很难回答这个问题,因为新冠肺炎,我错过了课程,所以我落后了,如果有人能用python代码回答这个问题的话,我将不胜感激。将链接复制并粘贴到新标签上
answer <- 0 // Making "answer" 0
column <- 8 // Making "column" 8
WHILE column < 1: // While "column" is less than 1:
OUTPUT "Enter bit value" // Prints the text
bit <- USERINPUT // The user's reply is saved to "bit"
answer <- answer + (column * bit) // Sum
column <- column / 2 // Making "column" half its' value
// While "column" is NOT less than 1:
OUTPUT "Decimal Value is: ", answer // Prints the text followed by the value of "answer"