premium = float(input("Enter premium : "))
commission = float(input("Enter commision : "))
profit = premium - commission
print(profit)
cc = 91
cc = str(cc)
mb = 7878584124
mb = str(mb)
mob_no = cc + mb
print("Your mobile number is :","+"+mob_no)
num1 = '56.7'
num1 = float(num1)
num2 = 66.7
result = num1 + num2
print(result)
import sys
sys.exit(0)
# input, output function, typecasting
# input function
# input function returns bydefault datatype string
a = input("Enter any number : ") # enter number is bydefault string
type
# a = int(a) # converted into integer using
int() function
a = float(a) # converted into integer using
float() function
b = complex(a)
print(a,type(a))
print(b,type(b))
# output function
mob = 786757434
print("my mobile number is : ",mob,"Thanks")
print("I am very happy",)
import sys
sys.exit(0)
# Basic/Fundamental Data types
# Numbers --> integer, float, complex
# String
# Boolean --> True, False
# NoneType
# comment
# integer --> -45, 986, 45
# float --> 34.67
# complex --> -7.6 + j9
# --> -7.6 --> real part
# --> 9 --> imaginary part
# print() --> to display the output
# type() --> the type of object/element
# / forward slash
# \ backward slash
# dynamic -->
# interpreted -->
# major datatype used --> string
a = 7
b = 9.5
c = 4.7-67j
d = True
e = False
f = None
g = 'shree'
h = """I am happy"""
print(a,type(a))
print(b,type(b))
print(c,type(c))
print(d,type(d))
print(e,type(e))
print(f,type(f))
print(g,type(g))
print(h,type(h))
# ans = a + b
# print("result is :",ans)
# print("I am display")
# print('Good morning')
# Operators
# --> Arithmatic Operators --> +, -, *, /, //,**,%
# --> Assignment Operators --> =, +=, -=, *=, /=, %=, **=, //=
# --> Comparison Operators --> ==, !=, >, >=, <, <=
# --> Logical Operators --> and, or, not
# --> Membership Operators --> in, not in
# --> Identity Operators --> is, is not
# --> Bitwise Operators --> &, |, ^, ~,<<, >>
# --> Identity Operators --> is, is not
a = 5896786
b = 5896786
print(a is b)
c = 7
print(a is not c)
print(id(a),id(b),id(c))
import sys
sys.exit(0)
# --> Logical Operators --> and, or, not
# and --> True only if all inputs are True, otherwise False
# or --> False only if all inputs are False, otherwise True
# not --> it inverts the input
a = not True
b = not False
print(a,b)
c1 = True and True
c2 = True and False
c3 = False and True
c4 = False and False
print(c1,c2,c3,c4)
o1 = True or True
o2 = True or False
o3 = False or True
o4 = False or False
print(o1,o2,o3,o4)
import sys
sys.exit(0)
# --> Comparison Operators --> ==, !=, >, >=, <, <=
print(25==10) # False # equal to
print(25!=10) # True # not equal to
print(25>10) # True # greater than
print(25>=10) # True # greater than equal to
print(25<10) # False # less than
print(25<=10) # False # less than equal to
import sys
sys.exit(0)
# --> Assignment Operators --> =, +=, -=, *=, /=, %=, **=, //=
a = 40
print(a) # 40
a +=5 # a = a+5
print(a) # 45
a -=7 # a = a-7
print(a) # 38
a %=5 # a = a%5
print(a) # 3
a *=17 # a = a*17
print(a) # 51
a /=2 # a = a/2
print(a) # 25.5
a //=6 # a = a//6
print(a) # 4
import sys
sys.exit(0)
# Arithmatic Operators
a = 25
b = 4
ans1 = a+b
print("addition :",a+b)
print("Subtraction :",a-b)
print("Multiplication :",a*b)
print("Division :",a/b)
print("Remainder :",a%b) # modulus %
print("Quotient :",a//b) # Floor division
a = 5
ans = a**3
print(ans)
import sys
sys.exit(0)
a = 10
print(a)
a = 20
print(a)