# Variables # 1. Write a statement that creates a variable named my_var # with a value "let's practice" my_var = "let's practice" #print(my_var) # 2. What type is my_var? # Write a statement to display the type of the variable my_var print(type(my_var)) # 3. Reassign any integer value to my_var my_var = 96 # 4. What type is my_var? # Write a statement to display the type of the variable my_var print(my_var) print(type(my_var)) # 5. Consider variable naming convention # Which one is valid? Whice one is good practice in Python? number_of_slices_of_bacon = 100 # a. badVariableName = "Java" # b. # 6. Write a statement that display an addition of two integers (5 and 9) sum = 5 + 9 print(sum) # 7. Write a statement that display a concatenation of three strings "input", "and", "output" # separated by a space string = "input " + "and" + " " + "output" print(string) # 8. Consider the following statements. What are differences? print(9.5 / 2.3) # a. print(format(9.5 / 2.3, ".7f")) # b. print(format(9.5 / 2.3, ".2f")) # c. print(format(9.5 / 2.3, ".2%")) # d. print(format(9.5 / 2.3, ".1f")) # 9.Write a statement that displays a raise of an integer to an integer power # (let's say 2 to the power of 3) power = 2 ** 3 print("2 ** 3 = " + str(power)) # 10. Write a statement that displays the remainder of division of 25 / 6 print("remainder = " + str(25 % 6)) # determine if 11 is an odd or even print(11 % 2) if 11 % 2 == 1: print("odd") else: print("even") # 11. Consider the following statements. What are differences? print("integer division : " + str(6 // 4)) print("division : " + str(6 / 4)) # 12. Write a statement to get an input from a keyboard (i.e., user's input) # and store this input in a variable called "your_name" # let's ask "What is your name ?" # and display "Hello, " followed by value stored in your_name # 13. Consider the following statement number = int(input("Give me a number between 0 and 100: ")) print(type(number)) # what do we get from this statement? number = int(number) + 4 print(type(number)) # what do we get from this statement? # 14. Consider the following statements. What happens? #number number / 0 number = number / 0