Objects: tuple, sets, range, boolean
-->> mathematical Operations
5 + 5
2 + 2/4
(2 +2 ) /4
12*5
12.*3
12//5 ### 12 /5 = 2 + res (2)
5**3
5^3
x = 2 + 4j <--- how to define a complex
x = min(5, 10, 25)
y = max(5, 10, 25)
pow(5,3) # as before
print(x)
print(y)
print("My values is:", x+y)
import math as mh
mh.
mh.sqrt(3)
x = mh.pi
mh.log(3) ## natural logarithm
mh.log10(3)
mh.ceil(1.4)
a= mh.exp(-5) ### e^-5
a
a = 2+ 4j
a = mh.factorial(3) ### mh. spyder automatically will display options
3*2*1 = 6
########## What is the data type??
type(a)
type(x)
### Setting (construct) specific data type
str(3) # What is the output? integer?
type( str(3) )
int(20.5)
int('3') ## ch --> int
float(20)
complex(1,1)
bool(0)
bool(2)
### structure u objetos
x= tuple( ("my","tuple") )
set(("apple", "banana", "cherry"))
{"Hola","You"}
--> dictionaries, list, bytes, ...
### Tuples
--> A tuple is a collection which is ordered and unchangeable.
tuple1 = ("abc", 34, True, 40, "male")
print(tuple1)
tuple1[0] ### python inicia en 0, python index starts at 0
tuple1[1] = 35 #####♥ ERROOORRRRRRR
c= (2,2,3,5, 8)
c[0]
c[4] = -5 ### what is the response?
### SET
-->> Set is a collection which is unordered and unindexed. No duplicate members.
thisset = {"apple", "banana", "cherry","lemon", 5}
print(len(thisset))
### ASSIGN VARIABLES
x = 5
x = y = z = "Hello"
x,y,z = "Hello", "You","!"
print(x)
print(y)
print(z)