Initial commit
This commit is contained in:
commit
a1ddfdb7c0
14 changed files with 599 additions and 0 deletions
23
exercise_1/task3-l.py
Normal file
23
exercise_1/task3-l.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
def divtwo(x):
|
||||
y=0
|
||||
z=0
|
||||
if (x>=0):
|
||||
z=x
|
||||
while ((z-y)>1):
|
||||
z=(z-1)
|
||||
y=(y+1)
|
||||
return y
|
||||
|
||||
def bin(x):
|
||||
z=0
|
||||
y=1
|
||||
if (x>0):
|
||||
y=divtwo(x)
|
||||
z=(x-(y+y))
|
||||
print(z)
|
||||
x=y
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
print(bin(2))
|
||||
Loading…
Add table
Add a link
Reference in a new issue