# Exercise: input and output # Date: Sep 7, 2016 # 1. Write a statement that creates a variable named my_var # with a value "let's practice" # 2. What type is my_var? # Write a staetment to display the type of the variable my_var # 3. Reassign any integer value to my_var # 4. What type is my_var? # Write a staetment to display the type of the variable 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) # 7. Write a statement that display a concatenation of three strings "input", "and", "output" # separated by a space # 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. # 9.Write a statement that displays a raise of an integer to an integer power # (let's say 2 to the power of 3) # 10. Write a statement that displays the remainder of division of 25 / 6 # 11. Consider the following statements. What are differences? print(6 // 4) print(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 = 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 # 15. Write statements to display the value of the following expressions # a. 9 // 2 # b. 9 % 2