1.Python Output:
print(): display text or output values
any text in python must be either " double quotes or ' single quotes
print("Double qoutes") #this is correct
print('single quotes') #this is also correct
print(This will cause an error) #SyntaxError: invalid syntax.
Print without a new line:
print("Hello world!", end= " ") #end= "" ...one line
print("hey, this's the same line.")
👉🏾Hello world!, this's the same line
Print Numbers:
print(3 + 5) #8
Casting:
If you want to specify the data type of a variable this can be done with casting
a = str(5) #'5'
b = int(4) #4
c = float(2) #2.0
Get the data type:
you can get the data type of a variable with type()
x = 4
y = "Python"
print(type(x)) # <class 'int'>
print(type(y)) # <class 'str'>
Keep learning💪 don't forget your journey to #MachineLearning