Answers for "// in python"

2

// in python

print(3 // 2)
# 1
print(3 / 2)
# 1.5
Posted by: Guest on October-26-2021
1

what is // in python

"""
  '//' is floor division on python which mean
  the result will be rounded down (eg: 3.14 become 3), so
  
  '5 // 2' will be 2
"""
Posted by: Guest on September-15-2021
13

! in python

#The (!) is the not operator in Python, (!=) means not equal to.
if 2!=10:
  print("2 isn't equal to 10.")
elif 2==10:
  print("2 is equal to 10.")
#Prints "2 isn't equal to 10." as 2 isn't equal to 10. Is it?

#Note that "=" is used for declarations (assign a value to a variable or change the value of one) while "==" is usually used for checking.
#Usually, "==" returns a boolean, but depends on the objects being checked if they're equal or not, that the result will be boolean.
#For example, some NumPy objects when checked will return values other than boolean (other than True or False).

#For example:

a = 10
print(a)

#will return the int 10
#Now,

print(a==10)

#will return a boolean, True as we have assigned the value of a as 10

#Another example (to make it easier and to avoid confusion) would be where

a = 10
b = 10

#and

print(a==b)

#will return a boolean, True as they're equal.
Posted by: Guest on September-05-2021
1

** in python

""" depends on the data type too """
def callme(key1, key2):
  print(key1, key2)
    
obj1 ,obj2 = 6, 9
obj3 = {
  "key1": 1,
  "key2": 2
}
callme(**obj3) # easy for calling functions
print(obj1 ** obj2) # Here it is a operator (for calculating obj1 ^ obj2)
Posted by: Guest on February-08-2021
2

** in python

# ** means modulus. or exponent
x = 6
y = 2
print(x**y) # will print 6 raised to power 2
Posted by: Guest on November-24-2020
0

** in python

print(10 * 10)
# 100
print(10 ** 10)
# 10000000000
Posted by: Guest on October-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language