@wuchang/

minirace1

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.10357857938674342","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZGVmIHN0cl90b19iaW4oX3N0cmluZyk6CiAgIiIiIFRha2VzIGEgc3RyaW5nIGFuZCBvdXRwdXRzIGVhY2ggY2hhcmFjdGVyJ3MgCiAgICB2YWx1ZSBhcyBpdHMgYmluYXJ5IEFTQ0lJIGNvZGUKICAgIDpwYXJhbSBfc3RyaW5nOiBzdHJpbmcgdG8gY29udmVydAogICAgOnJldHVybjogIGNvbnZlcnRlZCBzdHJpbmcKICAiIiIKICBtID0gIiIKICBmb3IgY2hhciBpbiBfc3RyaW5nOgogICAgbSArPSAiICB7bnVtOjA4Yn1cbiIuZm9ybWF0KG51bT1vcmQoY2hhcikpCiAgcmV0dXJuIG0KZGVmIHN0cl90b19oZXgoX3N0cmluZyk6CiAgIiIiIFRha2VzIGEgc3RyaW5nIGFuZCBvdXRwdXRzIGVhY2ggY2hhcmFjdGVyJ3MgCiAgICB2YWx1ZSBhcyBpdHMgaGV4YWRlY2ltYWwgQVNDSUkgY29kZQogICAgOnBhcmFtIF9zdHJpbmc6IHN0cmluZyB0byBjb252ZXJ0CiAgICA6cmV0dXJuOiAgY29udmVydGVkIHN0cmluZwogICIiIgogIG0gPSAiIgogIGZvciBjaGFyIGluIF9zdHJpbmc6CiAgICBtICs9ICJ7Onh9ICIuZm9ybWF0KG9yZChjaGFyKSkgCiAgcmV0dXJuIG0KCiMgUG9pbnQgYml0Lmx5IGxpbmsgdG8gYSBwYWdlIHRoYXQgaGFzIHB1enpsZQojICBlLmcuICJGb3Iga2V5IG9uZSwgd2hvIGFyZSAndGhlIG9uZXMnIG9uIHRoZSBzdG9uZSBiZW5jaGVzIG91dHNpZGUgb2YgRXBsZXIncyBIYWxsPyIiCnByaW50KHN0cl90b19oZXgoIlZpc2l0IGJpdC5seSB3aXRoIikpCgojIGJpdC5seSBsaW5rIHBvaW50cyB0byBHb29nbGUgRG9jIHRvIGVkaXQKcHJpbnQoc3RyX3RvX2JpbigiMllUd1Q0NyIpKQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def str_to_bin(_string):
  """ Takes a string and outputs each character's 
    value as its binary ASCII code
    :param _string: string to convert
    :return:  converted string
  """
  m = ""
  for char in _string:
    m += "  {num:08b}\n".format(num=ord(char))
  return m
def str_to_hex(_string):
  """ Takes a string and outputs each character's 
    value as its hexadecimal ASCII code
    :param _string: string to convert
    :return:  converted string
  """
  m = ""
  for char in _string:
    m += "{:x} ".format(ord(char)) 
  return m

# Point bit.ly link to a page that has puzzle
#  e.g. "For key one, who are 'the ones' on the stone benches outside of Epler's Hall?""
print(str_to_hex("Visit bit.ly with"))

# bit.ly link points to Google Doc to edit
print(str_to_bin("2YTwT47"))