position = 100position = 100.00type(position)float
x = 0.1+0.1jx.real0.1
x.imag0.1
x = "10"type(x)str
positon = 100float(position)100.0
str(position)'100.0'
type(position)float
position =str(position)type(position)str
tuple
position = (0,1,1,2,3)position[-1]3
type(position)tuple
list
positioon = [0,1,1,2,3]positioon[-5]0
position[2]1
type(positioon)list
details = [1,10.0,"siva", True]Dictionary
details = {
"position": 1,
"speed": 10.0,
"name": "siva",
"Truth": True
}details["Truth"]True
Set
set_1 = {0,0,1}set_1{0, 1}
set_2 = [0,0,1]set_2[0, 0, 1]
x = Nonetype(x)NoneType
Bool_1 = Truebool_2 = Falsebool(10)True
bool(0)False
bool([0.1])True
bool((0.1))True
bool({})False
x,y = 0.1,0.2x,y = 0.2,0.1x,y(0.2, 0.1)
x,y =y,xx,y(0.1, 0.2)
x,y = 0.1,0.2dummy = xx = yy=dummyx,y(0.2, 0.1)
x =0.5
y = x**2dynamic typing
print("MSC")MSC
print(5,6,7,8)5 6 7 8
x = 0.1
y = 0.2print(x,y)0.1 0.2
print(x,y,sep = "|")0.1|0.2
print("quadrotor \n failed")quadrotor
failed
print("quadrotor failed")quadrotor failed
print(4,end = "---")4---
def fibonnaci(n):
return n and (fibonnaci(n-1)+fibonnaci(n-2) or 0)fibonnaci(10)--------------------------------------------------------------------------- RecursionError Traceback (most recent call last) /tmp/ipykernel_13191/3106563500.py in <cell line: 0>() ----> 1 fibonnaci(10) /tmp/ipykernel_13191/2968301973.py in fibonnaci(n) 1 def fibonnaci(n): ----> 2 return n and (fibonnaci(n-1)+fibonnaci(n-2) or 0) ... last 1 frames repeated, from the frame below ... /tmp/ipykernel_13191/2968301973.py in fibonnaci(n) 1 def fibonnaci(n): ----> 2 return n and (fibonnaci(n-1)+fibonnaci(n-2) or 0) RecursionError: maximum recursion depth exceeded
def summation(n):
return n and (n+summation(n-1) or 0)summation(10)55
num1, num2 = 0,1
def f(n):
return n and f(n-1)+f(n-2) or 0
f(10)--------------------------------------------------------------------------- RecursionError Traceback (most recent call last) /tmp/ipykernel_13191/2758726514.py in <cell line: 0>() 4 return n and f(n-1)+f(n-2) or 0 5 ----> 6 f(10) /tmp/ipykernel_13191/2758726514.py in f(n) 2 3 def f(n): ----> 4 return n and f(n-1)+f(n-2) or 0 5 6 f(10) ... last 1 frames repeated, from the frame below ... /tmp/ipykernel_13191/2758726514.py in f(n) 2 3 def f(n): ----> 4 return n and f(n-1)+f(n-2) or 0 5 6 f(10) RecursionError: maximum recursion depth exceeded