Python: Type() and Factorials
-Type()-
In Python the Type() function gives us the type of a specific object with in the code that we have typed, for example:
Input:
a = ('Autobot', 'Decepticon', 'Human')
b = "Hello there!"
c = 66
x = type(a)
y = type(b)
z = type(c)
print(x)
print(y)
print(z)
Output:
<class 'tuple'>
<class 'str'>
<class 'int'>
As you can see we have now identified what the types are for each object which A is a Tuple, B a String and C an Integer.
-Factorials-
In python the math.factorial method allows you to return the factorial of a number but bare in mind that this method will only accept positive Integers. The Factorial of a number is the sum of the multiplication of the whole numbers from the number we specify down to 1. For example the factorial of 5 would be 5x4x3x2x1= 120.
Programming for Computer Animation and VFX TB1
Status | In development |
Category | Other |
Author | Aronne_Monk |
Leave a comment
Log in with itch.io to leave a comment.