diff --git a/ASSIGNMENTS/ATM Problem solved in Python b/ASSIGNMENTS/ATM Problem solved in Python new file mode 100644 index 00000000..2a26dc88 --- /dev/null +++ b/ASSIGNMENTS/ATM Problem solved in Python @@ -0,0 +1,12 @@ +t=int(input()) +for _ in range(t): + n,k=map(int,input().split()) + arr=list(map(int,input().split())) + s="" + for i in range(n): + if arr[i]<=k: + k-=arr[i] + s+='1' + else: + s+='0' + print(s) diff --git a/OPEN CHALLENGE/Decimal to Binary and Binary to Decimal b/OPEN CHALLENGE/Decimal to Binary and Binary to Decimal new file mode 100644 index 00000000..1645d432 --- /dev/null +++ b/OPEN CHALLENGE/Decimal to Binary and Binary to Decimal @@ -0,0 +1,21 @@ +def Binary(n): + global s + if(n > 1): + Binary(n//2) + s+=str(n%2) + return s + +def decimal(n): + n=int(n) + deci, i= 0, 0 + while(n!= 0): + dec = n% 10 + deci = deci + dec * pow(2, i) + n = n//10 + i += 1 + return deci + +s="" +print(Binary(1234)) +print(decimal(11010)) +