Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

ConvertfromBinary.py 1 number = 1101 2 3 #You may modify the lines of code above, but don't move them! 4 #When you submit your code,

image text in transcribed
image text in transcribed
image text in transcribed
ConvertfromBinary.py 1 number = 1101 2 3 #You may modify the lines of code above, but don't move them! 4 #When you submit your code, we'll change these lines to 5 #assign different values to the variables. 6 # 7 #The number above represents a binary number. It will always 8 #be up to eight digits, and all eight digits will always be 9 #either 1 or 0. 10 # 11 #The string gives the binary representation of a number. In 12 #binary, each digit of that string corresponds to a power of 13 #2. The far left digit represents 128, then 64, then 32, then 14 #16, then 8, then 4, then 2, and then finally 1 at the far right. 15 # 16 #So, to convert the number to a decimal number, you want to (For 17 #example) add 128 to the total if the first digit is 1, 64 if the 18 #second digit is 1, 32 if the third digit is 1, etc. 19 # 20 #For example, 00001101 is the number 13: there is a 0 in the 128 21 #place, 645 place, 32s place, 16s place, and 2s place. There are 22 #1s in the 8s, 4s, and 1s place. 8 + 4 + 1 = 13. 23 # 24 #Note that although we use 'if' a lot to describe this problem, 25 #this can be done entirely boolean logic and numerical comparisons. 26 # 27 #Print the number that results from this conversion 28 29 30 #Add your code here! 31 32 33 34 35 36 MuchWow.py 8 1 message = "101" 2 punct = "!" 3 num = 3 4 5 #You may modify the lines of code above, but don't move them! 6 #When you submit your code, we'll change these lines to 7 #assign different values to the variables. 9 #Using the values of message, punct, and num, print 10 #a string that looks like the one below if message = "101", 11 #punct = "I", and num = 3: 12# 13 # lollollolllollollolllollollol 14 # 15 #Specifically, it should start by printing message num times, 16 #then print punct. It should repeat that process num times, 17 #with punct printed between each time (but not at the start or 18 #end) 19 # 20 #Here are a couple other examples: 21 # 22 # message = "bbq", punct = "?", num = 2 -> bbgbbg?bbqbbq 23 # message = "bbi", punct = num = 3 -> bblbbibblobbibblbbl: bblbblbbl 24 # message = "brb" punct = num = 4 -> brbbrbbrbbrb.brbrbbrbrb.brbrbbrbbrb.brbbrbbrbbrb 25 27 #Add your code below! 28 26 29 30 31 RootSquared.py > 1 num = 4 2 3 #You may modify the lines of code above, but don't move them! 4 #When you submit your code, we'll change these lines to 5 #assign different values to the variables. 6 7 #write some code that calculates the square and the square root 8 #of the number given above. Then, it should print the square the 9 #square root number of times. If the square root is a decimal, 10 #round it down (you can do this by converting the decimal to 11 #an integer: Python will automatically round it down). 12 # 13 #For example, if num is 4, then your code would print: 14 # 15 # 1616 16 # 17 #That's 16 2 times. 4 squared is 16, the square root of 4 is 2, 18 #and so it prints 16 2 times. 19 # 20 #For another example: if num is 13, then 13 squared is 169, and 21 #the square root of 13 is ~3.6. 3.6 rounds down to 3. So, it would 22 #print: 169169169, or 169 3 times. 23 24 25 #Add your code here! 26 27 INNNN 28 29 BA

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started