ZN Code Saves
20 subscribers
2 photos
2 links
Code snippets and programming notes.

For testing bots and scripts, please join: @botspamdebug

More from ZN: @z_network
Download Telegram
Language:
py3


Source:
awberry = "๐Ÿ“"

print(str(awberry))


Result:
๐Ÿ“
Language:
py3


Source:
emojis='โค๏ธ ๐Ÿงก ๐Ÿ’› ๐Ÿ’š ๐Ÿ’™ ๐Ÿ’œ'

print(''.join(__import__('random').choice([x[0] for x in emojis.split(' ')]) for _ in range(60)))


Result:
๐Ÿ’™๐Ÿ’œโค๐Ÿ’›๐Ÿ’›๐Ÿ’šโค๐Ÿ’™๐Ÿ’œ๐Ÿงก๐Ÿ’™๐Ÿ’›๐Ÿ’œ๐Ÿงก๐Ÿ’™๐Ÿ’™๐Ÿงกโคโค๐Ÿ’›โค๐Ÿ’™๐Ÿ’™โค๐Ÿ’›๐Ÿ’›๐Ÿ’œ๐Ÿ’™โค๐Ÿ’™๐Ÿ’™๐Ÿ’›๐Ÿ’š๐Ÿ’š๐Ÿ’œ๐Ÿงก๐Ÿ’œ๐Ÿ’šโค๐Ÿ’œโค๐Ÿ’œ๐Ÿ’›๐Ÿ’›๐Ÿ’œ๐Ÿ’™๐Ÿ’™๐Ÿ’™๐Ÿ’š๐Ÿ’œ๐Ÿ’›๐Ÿงก๐Ÿ’™๐Ÿ’›๐Ÿ’›๐Ÿ’šโค๐Ÿงก๐Ÿ’™๐Ÿ’™
Language:
py3


Source:
code="def main():\n  print(gethi())\ndef gethi():\n  return'hi'\nif __name__=='__main__':main()"
exec(code)


Result:
hi
Language:
py3


Source:
import keyword as k
w=k.kwlist+['print','\"','\'','(',')',':','=']
e='โŽ๐Ÿšซโ˜‘โšซ๐Ÿ”œโœณ๐Ÿ’”๐Ÿซโ–ถ๐Ÿ“˜โ›”๐Ÿ™ƒ๐Ÿ™„๐Ÿ˜ฑ๐Ÿ˜…โญโซ๐ŸŒ๐Ÿค”๐Ÿšขโฌโ†”โ™Œ๐Ÿ‘ฝโŒโž•๐Ÿ’จ๐Ÿ™‹๐Ÿ”™โ“๐Ÿ”ƒ๐Ÿ”€๐Ÿ”บ๐Ÿ–จโ€ผโ—โ†ชโ†ฉโ†•โžฐ'
d,i={},0
for j in e:
d[j]=w[i];i+=1
print(d)


Result:
{'๐Ÿ™ƒ': 'elif', 'โฌ': 'in', 'โž•': 'or', 'โ–ถ': 'continue', 'โ†”': 'is', '๐Ÿซ': 'class', 'โซ': 'from', 'โ™Œ': 'lambda', '๐Ÿ’”': 'break', '๐Ÿ™„': 'else', 'โ“': 'try', 'โ˜‘': 'True', '๐ŸŒ': 'global', '๐Ÿ”€': 'with', '๐Ÿ”œ': 'as', 'โ›”': 'del', 'โŒ': 'not', '๐Ÿšซ': 'None', 'โ†ช': '(', 'โšซ': 'and', 'โ—': "'", '๐Ÿ–จ': 'print', '๐Ÿ”บ': 'yield', 'โ†ฉ': ')', '๐Ÿ“˜': 'def', 'โžฐ': '=', '๐Ÿ”ƒ': 'while', 'โญ': 'for', '๐Ÿ˜…': 'finally', 'โœณ': 'assert', 'โŽ': 'False', '๐Ÿšข': 'import', '๐Ÿ™‹': 'raise', '๐Ÿ‘ฝ': 'nonlocal', '๐Ÿ’จ': 'pass', '๐Ÿ˜ฑ': 'except', 'โ€ผ': '"', '๐Ÿค”': 'if', 'โ†•': ':', '๐Ÿ”™': 'return'}
Language:
py3


Source:
import keyword as k
w=k.kwlist+'print " \' ( ) : = \n'.split(' ')
e='โŽ๐Ÿšซโ˜‘โšซ๐Ÿ”œโœณ๐Ÿ’”๐Ÿซโ–ถ๐Ÿ“˜โ›”๐Ÿ™ƒ๐Ÿ™„๐Ÿ˜ฑ๐Ÿ˜…โญโซ๐ŸŒ๐Ÿค”๐Ÿšขโฌโ†”โ™Œ๐Ÿ‘ฝโŒโž•๐Ÿ’จ๐Ÿ™‹๐Ÿ”™โ“๐Ÿ”ƒ๐Ÿ”€๐Ÿ”บ๐Ÿ–จโ€ผโ—โ†ชโ†ฉโ†•โžฐ๐Ÿ†•'
d,i={},0
for j in e:
d[j]=w[i];i+=1
n='๐Ÿ“˜ mโ†ชโ†ฉโ†•๐Ÿ†• ๐Ÿ–จโ†ชโ—โ€ผhiโ€ผโ—โ†ฉ๐Ÿ†•๐Ÿค” __name__โžฐโžฐโ—__main__โ—โ†•๐Ÿ†• mโ†ชโ†ฉ'
exec(''.join([(x if x not in d else d[x]) for x in n]))


Result:
"hi"
Language:
py3


Source:
print('๐Ÿ‘ฉโ€๐ŸŽ“'.strip('๐ŸŽ“'))


Result:
๐Ÿ‘ฉโ€
Language:
py3


Source:
print('\n'.join('{0} bottles of beer on the wall, {0} bottles of beer, you take one down and pass it around, {1} bottles of beer on the wall'.format(i, i-1) for i in (range(99, 97,-1))))


Result:
99 bottles of beer on the wall, 99 bottles of beer, you take one down and pass it around, 98 bottles of beer on the wall
98 bottles of beer on the wall, 98 bottles of beer, you take one down and pass it around, 97 bottles of beer on the wall
Language:
py3


Source:
s='\u0336'
def striketext(string):
return s.join([*string,''])

print(striketext("this text is striked"))


Result:
tฬถhฬถiฬถsฬถ ฬถtฬถeฬถxฬถtฬถ ฬถiฬถsฬถ ฬถsฬถtฬถrฬถiฬถkฬถeฬถdฬถ
Forwarded from Zac
Language:
py3


Source:
import random as r
c = {1:"",2:"",3:"",4:"๐Ÿ’ฃ",5:"",6:""}
print('russian roulette:\n*spin*\n*click*\n')
print("*bang*\n*ded*" if not c[r.choice(list(c.keys()))] == "" else ":) *yolo*")


Result:
russian roulette:
*spin*
*click*

:) *yolo*
Forwarded from Zac
Language:
py3


Source:
import random as r
c = {1:"",2:"",3:"",4:"๐Ÿ’ฃ",5:"",6:""}
print('russian roulette:\n*spin*\n*click*\n')
print("*bang*\n*ded*" if not c[r.choice(list(c.keys()))] == "" else ":) *yolo*")


Result:
russian roulette:
*spin*
*click*

*bang*
*ded*
Language:
py3


Source:
o,h,e,q,c,k='โ€ข','<','no he*cks given.',7,13,'โ€”';d=['โ €']*c;v=['']*q;p=[[i for i in d] for j in v];p[0][6]=p[1][3]=p[1][9]=p[3][1]=p[3][11]=p[5][0]=p[5][6]=p[5][12]=o;p[5][2]=h;p[5][3]=p[5][4]=p[5][5]=k;
print(*[''.join(x) for x in p],e, sep='\n')


Result:
โ €โ €โ €โ €โ €โ €โ€ขโ €โ €โ €โ €โ €โ €
โ €โ €โ €โ€ขโ €โ €โ €โ €โ €โ€ขโ €โ €โ €
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €
โ €โ€ขโ €โ €โ €โ €โ €โ €โ €โ €โ €โ€ขโ €
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €
โ€ขโ €<โ€”โ€”โ€”โ€ขโ €โ €โ €โ €โ €โ€ข
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €
no he*cks given.
Language:
py3


Source:
o,h,e,q,c,k='๐Ÿ”น','โ—','no he*cks.',7,13,'โ€”';d=['โ €']*c;v=['']*q;p=[[i for i in d] for j in v];p[1][6]=p[2][2]=p[2][9]=p[3][1]=p[3][10]=p[4][0]=p[4][11]=p[5][0]=p[5][10]=o;p[5][2]=h;p[5][3]=p[5][4]=p[5][5]=k;p[5][6]='โ–ซ๏ธ'
print(*[''.join(x) for x in p],e, sep='\n')


Result:
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €
โ €โ €โ €โ €โ €โ €๐Ÿ”นโ €โ €โ €โ €โ €โ €
โ €โ €๐Ÿ”นโ €โ €โ €โ €โ €โ €๐Ÿ”นโ €โ €โ €
โ €๐Ÿ”นโ €โ €โ €โ €โ €โ €โ €โ €๐Ÿ”นโ €โ €
๐Ÿ”นโ €โ €โ €โ €โ €โ €โ €โ €โ €โ €๐Ÿ”นโ €
๐Ÿ”นโ €โ—โ€”โ€”โ€”โ–ซ๏ธโ €โ €โ €๐Ÿ”นโ €โ €
โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €โ €
no he*cks.
Language:
py3


Source:
h,t,g,o,s,n= ['๐Ÿบ', '๐Ÿช', '๐ŸŒฎ'],'๐Ÿ—‘๏ธ','< (^_^ <)','(> ^_^) >','โ €','\n\n';d=len(h)
for i in reversed(range(d)):
z=[[*h,s,g,s,t],[*h,g,s,s,t],[*h[:i],o,h[i],s,t],[*h[:i],s,o,h[i],t],[*h[:i],s,s,o,t],[*h[:i],s,s,g,t]];print(*[''.join(x) for x in z],sep=n);h[i]=''


Result:
๐Ÿบ๐Ÿช๐ŸŒฎโ €< (^_^ <)โ €๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿช๐ŸŒฎ< (^_^ <)โ €โ €๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿช(> ^_^) >๐ŸŒฎโ €๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿชโ €(> ^_^) >๐ŸŒฎ๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿชโ €โ €(> ^_^) >๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿชโ €โ €< (^_^ <)๐Ÿ—‘๏ธ
๐Ÿบ๐Ÿชโ €< (^_^ <)โ €๐Ÿ—‘๏ธ

๐Ÿบ๐Ÿช< (^_^ <)โ €โ €๐Ÿ—‘๏ธ

๐Ÿบ(> ^_^) >๐Ÿชโ €๐Ÿ—‘๏ธ

๐Ÿบโ €(> ^_^) >๐Ÿช๐Ÿ—‘๏ธ

๐Ÿบโ €โ €(> ^_^) >๐Ÿ—‘๏ธ

๐Ÿบโ €โ €< (^_^ <)๐Ÿ—‘๏ธ
๐Ÿบโ €< (^_^ <)โ €๐Ÿ—‘๏ธ

๐Ÿบ< (^_^ <)โ €โ €๐Ÿ—‘๏ธ

(> ^_^) >๐Ÿบโ €๐Ÿ—‘๏ธ

โ €(> ^_^) >๐Ÿบ๐Ÿ—‘๏ธ

โ €โ €(> ^_^) >๐Ÿ—‘๏ธ

โ €โ €< (^_^ <)๐Ÿ—‘๏ธ
s/(?<![ls ])c(?![hkt ])|s/th/gi
Language:
py3


Source:
t,g,o,s,c,n,m,w='๐Ÿ—‘','<(^_^ <)','(> ^_^)>','โ €','โ €โ €','\n\n',-1,' ';h='๐Ÿ’ฐ',w,'๐Ÿ”ง';d=len(h)
for i in range(d+m,m,m):
j,k=h[i],h[:i]
if j==w:h=k;continue
print(*[''.join(x) for x in (h+(s,g,s,t),h+(g,c,t),k+(o,j,s,t),k+(s,o,j,t),k+(c,o,t),k+(c,g,t))],sep=n);h=k


Result:
๐Ÿ’ฐ ๐Ÿ”งโ €<(^_^ <)โ €๐Ÿ—‘

๐Ÿ’ฐ ๐Ÿ”ง<(^_^ <)โ €โ €๐Ÿ—‘

๐Ÿ’ฐ (> ^_^)>๐Ÿ”งโ €๐Ÿ—‘

๐Ÿ’ฐ โ €(> ^_^)>๐Ÿ”ง๐Ÿ—‘

๐Ÿ’ฐ โ €โ €(> ^_^)>๐Ÿ—‘

๐Ÿ’ฐ โ €โ €<(^_^ <)๐Ÿ—‘
๐Ÿ’ฐโ €<(^_^ <)โ €๐Ÿ—‘

๐Ÿ’ฐ<(^_^ <)โ €โ €๐Ÿ—‘

(> ^_^)>๐Ÿ’ฐโ €๐Ÿ—‘

โ €(> ^_^)>๐Ÿ’ฐ๐Ÿ—‘

โ €โ €(> ^_^)>๐Ÿ—‘

โ €โ €<(^_^ <)๐Ÿ—‘
from collections import Counter
n='Alexandru Popescu'
L,v=n.upper().replace(' ',''),reversed
c=Counter(L)
T=sorted([(k,c[k]) for k in c.keys() if c[k]>1], key=lambda e:(e[1],e[0]))
if not T:T=[(L)]
j=['-'.join(v([p[0]+str(p[1]) for p in T if p[1]>T[0][1]]))]
if j[0]=='':j=[T[-1][0]+str(T[-1][1])]
m=''.join(v([x[0] for x in T if x[1]==T[0][1]]))
print (*j+[m] if len(j)>2 else j+['-']+[m[1:4] if len(m)>2 else m[1:4]+'O'],sep='')
def droid_name_gen(name):
n=__import__('re').sub('[^\\w]','',str(name))
if not n:return "Name Invalid.\nR2-D2: sad beep x'("
L=n.upper()
v=reversed
c=__import__('collections').Counter(L)
T=sorted([(k,c[k]) for k in c.keys() if c[k]>1], key=lambda e:(e[1],e[0]))
if T==[]:T=[(L[0],str(len(L))[0], (L[-1]))]
j=['-'.join(v([p[0]+str(p[1]) for p in T if p[1]>=T[0][1]]))]
jf=j[0][:2]
if len(j[0])==5:
if jf[1]==j[0][4]:j=[j[0][:5]]
elif len(j[0])>=8:
if jf[1]==j[0][4]:j=[j[0][:5]]
elif j[0][4] == j[0][7]:j=[j[0][:2]]
elif j[0]=='':j=[T[-1][0]+str(T[-1][1])]
m=''.join(v([x[0] for x in T if x[1]<=T[0][1]]))
e=j if len(j[0])>=5 else (j+['-']+[(m[1:4]) if len(m)>2 else (m[1:4]+('O' if len(m)>1 else 'O'+str(T[-1][-1])))])
return ''.join(e)

if __name__=="__main__":
import sys
if len(sys.argv)>1:
print(droid_name_gen(''.join([str(x) for x in sys.argv[1:]])))
else:
print("Please enter a name")
s/((([aeiou]|(?<![aeiou])y(?![aeiou]))|(\B[aeiou]|(?<![aeiou])y(?![aeiou])))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,'"\n()\[\]{}])(([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,]\B))|(\B([aeiou]|(?<![aeiou])y(?![aeiou]))|(\B[aeiou]|(?<![aeiou])y(?![aeiou])))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,]))|(([^aeiouy .,'"\n()\[\]{}])([^aeiouy .,'"\n()\[\]{}])([aeiou]|(?<![aeiou])y(?![aeiou]))([aeiou]|(?<![aeiou])y(?![aeiou])))|(\b[^aeiouy .,'"\n()\[\]{}])([aeiou]|(?<![aeiou])y(?![aeiou]))([aeiou]|(?<![aeiou])y(?![aeiou]))([^aeiouy .,'"\n()\[\]{}]\b)/\3\6\5\9\8\11\14\13\16\18\17\19\20\21\23\22/gi
group_of_groups = [['telethonchat','telethonofftopic'],['pyrogramchat','pyrogramlounge']]
all_dict,common = {},[]
for index, group_group in enumerate(group_of_groups):
all_dict[str(index)] = []
for group in group_group:
lst1 = client.iter_chat_members(group)
for user in lst1:
first = user.user.first_name
username = user.user.username or ' '
un = f'@{username}:' if username!=' ' else ''
last = user.user.last_name or ' '
uid = user.user.id
user_form = f'{un}{uid}:{first} {last}'
all_dict[str(index)].append(user_form)
keys_list = list(all_dict.keys())
for index,group_group1 in enumerate(keys_list):
for group_group_user1 in all_dict[group_group1]:
for group_group2 in keys_list[index+1:]:
for group_group_user2 in all_dict[group_group2]:
if group_group_user1 == group_group_user2 and group_group_user1 not in common:
common.append(group_group_user1)
with open ('list_common.txt', 'w') as f:
f.write('\n'.join([x for x in common]))
client.send_document(mcid, 'list_common.txt')