# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + id="dlrMB-Qy2taV" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 51} executionInfo={"status": "ok", "timestamp": 1596261217035, "user_tz": 420, "elapsed": 374, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="526f59e2-397b-43cc-cd3d-6f92bf792690"
#Declare a float value and store it in a variable. 


a=10.5


#Check the type and print the id of the same.
print(type(a))
print(id(a))



# + id="IL4fVDHg2wbI" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 136} executionInfo={"status": "ok", "timestamp": 1596261529626, "user_tz": 420, "elapsed": 938, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="80ecdcba-142c-42af-cb08-56f3f1d8cbb3"
#Arithmatic Operations on float
#Take two different float values.
#Store them in two different variables.

#Do below operations on them:-
    #Find sum of both numbers
a=6.78
b=5.55
sum=a+b
print(sum)
    #Find differce between them
difference=a-b
print(difference)    
    #Find the product of both numbers.
product=a*b
print(product)
    #Find value after dividing first num with second number
div=a/b
print(div)
    #Find the remainder after dividing first number with second number
modulo=a%b
print(modulo)
    #Find the quotient after dividing first number with second number
quotient=a/b
print(quotient)
    #Find the result of first num to the power of second number.
power=a**b  
print(power)  

# + id="atCFaH6c2492" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 85} executionInfo={"status": "ok", "timestamp": 1596261588373, "user_tz": 420, "elapsed": 310, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="98786473-98b7-4b56-ad10-86de9dfb3042"
#Comparison Operators on float
#Take two different float values.
#Store them in two different variables.

#Do below operations on them:-
    #Compare these two numbers with below operator:-
        #Greater than, '>'

        #Smaller than, '<'

        #Greater than or equal to, '>='

        #Less than or equal to, '<='

#Observe their output(return type should be boolean)


c=3.67
d=3.72
print(c>d)
print(c<d)
print(c>=d)
print(c<=d)







# + id="agi3U3863A5i" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 68} executionInfo={"status": "ok", "timestamp": 1596261702493, "user_tz": 420, "elapsed": 424, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="92f81aaa-e2fe-416a-ae04-51e83d0467b7"
#Equality Operator
#Take two different float values.
#Store them in two different variables.

#Equuate them using equality operator (==, !=)

#Observe the output(return type should be boolean)
c1=5.78
c2=7.89
c3=5.78
print(c1==c2)
print(c3==c1)
print(c1!=c3)





# + id="3HLlgaEt3EnJ" colab_type="code" colab={}
#Logical operators
#Observe the output of below code
#Cross check the output manually

print(10.20 and 20.30)       #both are true and second value taken >Output is 20.3
print(0.0 and 20.30)         #First is false so first value taken->Output is 0.0
print(20.30 and 0.0)         #Goes to till second and second value is false so second is taken>Output is 0.0
print(0.0 and 0.0)           #First is false so first value is taken->Output is 0.0

print(10.20 or 20.30)        #First is True so first value is taken>Output is 10.2
print(0.0 or 20.30)          #Goes to till second and second is true second value is taken->Output is 20.3
print(20.30 or 0.0)          #First is True so first value is taken->Output is 20.3
print(0.0 or 0.0)            #Goes to till second and secod is also false and second value is taken>Output is 0.0

print(not 10.20)             #-Not of true is false->Output is False
print(not 0.0)               #Not of false is True>Output is True

# + id="7YdyRNtk3UZd" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 51} executionInfo={"status": "ok", "timestamp": 1596261733701, "user_tz": 420, "elapsed": 312, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="fff30d07-c96b-4532-cf68-183d8b5b547e"
#What is the output of expression inside print statement. Cross check before running the program.
a = 10.20
b - 10.20
print(a is b)          #True or False? True 10.20<256 --false
print(a is not b)      #True or False? False.         --true


# Why the Id of float values are different when the same value is assigned to two different variables
# ex: a = 10.5 b=10.5. but id will be same if I assign the variable having float i.e. a=c then both a anc c's
# Id are same


# + id="iTvnIMLd3VLW" colab_type="code" colab={}
#Bitwise operation is not applicable between instances of float.
## Why the Id of float values are different when the same value is assigned to two different variables
## ex: a = 10.5 b=10.5. but id will be same if I assign the variable having float i.e. a=c then both a anc c's
## Id are same
#Object reusability concept is not applicable on float values.

# + id="29AVJHpx3YUo" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 119} executionInfo={"status": "ok", "timestamp": 1596261791974, "user_tz": 420, "elapsed": 454, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/-FXsetuIjTxg/AAAAAAAAAAI/AAAAAAAAAO4/TYiDKhUGRd0/s64/photo.jpg", "userId": "09258938025824762674"}} outputId="97ae1c08-0f43-4062-daa8-88501d0c7ec6"
#Membership operation
#in, not in are two membership operators and it returns boolean value

print('2.7' in 'Python2.7.8')              #True
print(10.20 in [10,10.20,10+20j,'Python']) #True
print(10.20 in (10,10.20,10+20j,'Python')) # True
print(20.30 in {1,20.30,30+40j})           # True
print(2.3 in {1:100, 2.3:200, 30+40j:300}) # True
print(10 in range(20))                     # True

StarcoderdataJupyterScriptsDedupFiltered