Day 1 Notes
Day 1 Notes
eg:
print('asif')
data type
integer = int = any whole number in python is regarded as an int data type
eg:
age = 25
price = 150
floating point = float = any decimal number is regarded as a floating point number
eg:
price = 150.7
distance = 120.4
type casting: method for changing the data type a varaible or anything we pass
variable or value to the bracket of new data type
a = 30 ===> integer data type
if we want to conver this data to string
a = str(30)
or
a = str(30)
print(a)
output ==> '30'
print(type(a))
cls<'str'>
a = int(a)
print(a)
output ==> 25
print(type(a))
output ==> cls<'int'>
input function: is use when we want to take any input from user
eg:
my_name = input("enter your name :")
print(f"my name is {input}") #====> i have use f string format to enclose the
variable in a print statement
output:
enter your name : asif
my name is asif