My Python Class today, May 29ht, 2013 was really good.
Then print type2
Create a variable called type3 and set it to the type of an string
Then print type3
"""
# Here's an example for you:
type0 = type(True)
print type0
type1 = type(30)
print type1
type2 = type(6.8)
print type2
type3 = type ("Enjoying my python class !")
print type3
Learning Python
Lesson 5 : Functions
Importing Modules
Simple programming exercises from Codecademy
"""
# Exercise 0 : Generic Imports
"""
Type import math
Print the square root of 25
For example, print math.sqrt(36) will print 6.0
"""
from math import*
print sqrt(144)
# Exercise 1 : Function Imports
"""
Change the import so that you only import the sqrt function, like this:
from math import sqrt
Print the square root of 100
For example, print sqrt(81) will print 9.0
"""
# Exercise 2 : Function Imports
"""
Change the import so that you import everything from the math module, like this:
from math import *
Print the square root of 144
For example, print sqrt(25) will print 5.0
"""
These are few answers from this class.
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
10
>>>
10
7
>>>
10
They are equal
>>>
10
87
>>>
10
-10
10
<type 'bool'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Failed!
Exercise 2 : Test Failed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
<type 'bool'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Failed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
<type 'bool'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>
<type 'int'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>
<type 'int'>
<type 'float'>
<type 'str'>
Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Passed!
>>>
6.0
>>>
5.0
10.0
>>>
10.0
>>>
12.0
No comments:
Post a Comment