1 num pancakes 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 a line of code below that will print the following 8 #message: 9 # 10 #The most pancakes Bob has eaten at one time is 7 11 # 12 #The number in the sentence should always be the value of 13 #num_pancakes. 14 # 15 #However, you may not use the + operator. You must put 16 #together the output in a different way. 17 # 18 #Add your code below! 19 20 21 22 1 #The code below creates a variable named my_int and 2 #assigns to it a random number from 0 to 10. You 3 #don't need to worry about how this works; all you 4 #need to know is that my_int will have an integer 5 #as its value once this code is done. 6 7 import random 8 my_int random.randint(0, 10) 9 10 #Do not edit the code above! 11 # 12 #The line below attempts to print the value of 13 #my_int, but currently it does not work. Fix 14 #this code so that it works and prints "The 15 #current value of my_int is:", followed by the 16 #value. 17 # 18 #If you get stuck, look back at the Converting to 19 #Strings vide from Lesson 2.2.7. 20 21 print("The current value of my_int is: + my_int) 22 23 24 1 #Modify the code below so that the output matches the following: 2# 3 #
4 #class 'int'> 5 # 6 # 7 # 8 #Don't write any new lines. Just rearrange the existing lines so 9 #that the output matches the above. 10 11 print(type(5.1)) 12 print type 5)) 13 print type "Hello!")) 14 print(type (True)) 15 16 1 total 2.51 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 code below attempts to print the message: 8 # 9 #Thank you for coming to Junior's. Your total is $2.51. 10 # 11 #Right now, however, the code is broken because the variable 12 #total must be converted to a string before printing. 13# 14 #Fix the code below! You may fix it however you want. 15 16 print("Thank you for coming to Junior's. Your total is $" + total + ".") 17 18 19 1 name= "Elphaba" 2 verb = "flew" 3 where = "the western sky" 4 number = 5 5 result = True 6 7 #You may modify the lines of code above, but don't move them! 8 #When you Submit your code, we'll change these lines to 9 #assign different values to the variables. 10 11 #Above we have created five variables: name, verb, and where 12 #which are strings, number which is an integer, and result, 13 #which is a boolean. 14 # 15 #Below, write some code that will take these variables and 16 #print out the sentence below with the values of the variables 17 #filling in the corresponding spots in the sentence as 18 #indicated by the variable name in brackets. 19 20 #My name is [name] and it is [result] that I [verb) across [where] [number] times. 21 # 22 #Make sure to watch out for the data types of the values of 23 Heach of these variables, and make sure you have the right 24 #number of spaces between each part! 25 # 26 # 27 #Add your code below: 1 ones = 8 2 tens = 6 3 hundreds 1 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. 8 # 9 #Imagine you want to find the integer represented by the 10 #variables ones, tens, and hundreds above. For their initial 11 #values, then, this would be 168. 12 # 13 #Below is some code that attempts to compute and print that 14 #value, but at present it isn't working. Fix it so that it 15 #works correctly. 16 # 17 #Fix the code below! 18 19 result = hundreds + tens + ones 20 print(result) 21 22 23 NNNN 24