import math #Data Conversion #Make the following code work by either 1) completing the tasks #in the comments 2) removing the underscores with your own code #3) answering the questions in the comments. #Copy and Paste the entire code into a word document #or submit the .py files to Canvas when you are finished. # Create a variable on line 12 that holds the number 2.867. # What data type does the variable have? Answer: _____ = 2.867 # Create a variable that holds the value 2.986 in line 15 # create a variable to hold the sum of your first 2 variables on line 19 # Why can you not use the word sum for your variable name? Answer: # use the the int function on your first variable on line 25 and the second variable on line 26 # Remember programming works right to left so whatever is performed on the right side is stored on the left # What does the int funciton do? Answer: # Why are these types of functions important? Answer: _____ = int(_____) _____ = int(_____) # Use the ceiling function on your variable from line 19 (that holds your sum) on line 30 # What does the ceiling function do? Answer: ________ = math.ceil(_______) # Fill in the following print statements with your variables print(____) print(____) print(____)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question