Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import discord
  2. import random
  3. import math
  4. graph = []
  5. h = 15
  6. w = 20
  7. choice = [1,0]
  8. for i in range(h):
  9. graph.append([])
  10. for j in range(w):
  11. graph[i].append(0)
  12.  
  13. for i in range(-10,10):
  14. eqval = math.sqrt(i)
  15.  
  16. eqval = round(-eqval)
  17. eqval+=round(h/2)
  18.  
  19. if (eqval>=0 and eqval<h):
  20. graph[ eqval ][ i ] = 1
  21.  
  22. print(graph)
  23.  
  24. class MyClient(discord.Client):
  25. async def on_ready(self):
  26. print('Logged on as', self.user)
  27.  
  28. async def on_message(self, message):
  29. # don't respond to ourselves
  30. if message.author == self.user:
  31. return
  32.  
  33. if message.content == 'pr':
  34. await message.channel.send('ƒ(x) = *sin*(x)')
  35. finStr = ''
  36. for i in graph:
  37. for j in i:
  38. if (j==1):
  39. finStr+= '██'
  40. if (j==0):
  41. finStr+= '░░'
  42.  
  43.  
  44. finStr += '\n'
  45. await message.channel.send(finStr)
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. client = MyClient()
  53. client.run('NjEzNzIzMjk3Nzc0ODI5NTk4.XV1EqA.qo-mRzndUe0fAGwNX6wsXs4JOp4')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement