diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-31 16:22:52 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-01-31 16:22:52 +0000 |
commit | 45b06ac98819bfcad5f490c580d25fb0bf90c8ad (patch) | |
tree | 4f00b8a96847bccc605eea0e7154a3bd36a2fb5a /comp/work/42/test/test.py | |
parent | 00e419fa183247d6d94b7eaf274bd2ae6225c646 (diff) | |
parent | 02653ab40d93fb7e6d07edb747fe0e07c5d60c74 (diff) |
performing merge
Merge branch 'master' of git://git.seacrossedlovers.xyz/school
Diffstat (limited to 'comp/work/42/test/test.py')
-rw-r--r-- | comp/work/42/test/test.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/comp/work/42/test/test.py b/comp/work/42/test/test.py new file mode 100644 index 0000000..4e70d92 --- /dev/null +++ b/comp/work/42/test/test.py @@ -0,0 +1,21 @@ +def tostring(list): + string = "" + for i in list: + string += str(i) + print(string) + +def getbin(n): + out = [] + while (n >= 1): + out.append(n % 2) + n = int(n / 2) + + out.reverse() + return out + +def tobin(n): + raw = getbin(n) + tostring(raw) + +n = int(input("what number would you like to convert: ")) +tobin(n) |