In [1]:
import sys
print(sys.version)
At this point anything above python 3.5 should be ok.
In [2]:
print(2 / 3)
print(2 // 3)
print(2 - 3)
print(2 * 3)
print(2 ** 3)
print(12 % 5)
In [3]:
print("Welcome" + " to the " + "BornAgain" + " School")
In [4]:
print([1, 2, 3, 4] + [5, 6, 7, 8])
print((1, 2, 3, 4) + (5, 6, 7, 8))
In [5]:
print(5 < 6)
print(5 >= 6)
print(5 <= 6)
print(5 == 6)
print(5 in [1, 2, 3, 4, 5, 6, 7])
In [6]:
print(5 < 6 and 5 >= 6)
print(5 >= 6 or 5 < 6)
print(not 5 == 6)
In [ ]:
In [7]:
a = 2.0
b = 3.0
c = 4.0
print(type(a))
#print(float.__dict__)
print(a / b)
print(a.__truediv__(b))
print(c >= b)
print(c.__ge__(b))
In [8]:
a = [
0.0,
1.0,
6.2,
5.333,
9,
4,
3.4]
print("a is equal to ", a)
print("a is of type: ", type(a))
print("a[0] is equal to ", a[0], "and is of type: ", type(a[0]))
print("a[4] is equal to ", a[4], "and is of type: ", type(a[4]))
In [9]:
b = a[2:4]
print(b)
b = a[:4]
print(b)
b = a[2:]
print(b)
b = a[::-1]
print(b)
b = a[2:6:2]
print(b)
In [ ]:
In [10]:
iterator = iter(a)
print(type(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
print(next(iterator))
In [11]:
for element in a:
print(element, type(element))
In [12]:
b = 4
for element in a:
if element < b:
print(element, "is smaller than ", b)
elif element == b:
print(element, "is equal to ", b)
else:
print(element, "is bigger than ",b)
In [ ]: