This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p1 = input('Emter rock/paper/siccor OR press q to quit : ') | |
p2 = input('Emter rock/paper/siccor OR press q to quit : ') | |
while p1 != 'q' and p2 != 'q': | |
if p1 == 'rock' and p2 == 'siccor': | |
print('Player 1 has won ') | |
elif p1 == 'paper' and p2 == 'rock': | |
print('player has won : ') | |
elif p1 == 'siccor' and p2 == 'paper': | |
print('player 1 has won') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
def guess_game(): | |
'''Life Is NOthing But A Game''' | |
user_guess = input('Bro enter a random number / OR PRess q to quti : ') | |
computer = random.randint(0,9) | |
while user_guess != 'q': | |
try: | |
user_guess = int(user_guess) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
m = [5,2,6,9,5,2,65,6,5,5,5,5,5] | |
k = [x for x in range(0,random.randint(0,90))] # using random.randint() to generate a random list | |
common_list = [x for x in m for y in k if x == y] # using list comprehension to seek common elements from the list | |
new_set = set(k) # using the set constructor to convert the list into the set so there will be no duplicatopn of the element | |
final_list = list(new_set) # converting back into list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_number(): | |
give = int(input('Enter the number you want to check is prime or not : ')) # asking input andconverting it into integer since by default it will be string | |
give1 = int(give/2) # we know a number greater than the half of that number won't be able to divide it | |
# COnveriting into integer because the result will be float | |
for i in range(1,give1): | |
if give % i == 0: | |
print('THe number {} is prime'.format(give)) | |
break # since there is now no pint in continuing the if loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def listing(): | |
list1 = [1,2,5,4,8,9,6,3,6,4,9,5] | |
list2 = [] | |
counter = 0 | |
for x in list1: | |
if counter == 0 or counter == (len(list1) - 1): | |
list2.append(list1[counter]) | |
else: | |
pass # if condition is not matched then pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def password_generator(): | |
alpha = '''A- B1CDE2*FGH6IJ3&KL_M4NOP5QRS7TU^8VW9XY0Zabc@defg#hijk~lm%no!pqrs¬tuv`w|xy.$,z''' # these are the words and symbols from which the password is generaterd | |
ans = input('How Strong do you want your password to be : (strong/medium/low) ') | |
password = '' | |
while ans.lower() != 'q': | |
if ans == 'strong': | |
for i in range(0,12): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from urllib.request import urlopen | |
m = urlopen('http://www.nytimes.com') | |
soup = BeautifulSoup(m,'html.parser') | |
print(soup.find_all('article')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from elasticsearch import Elasticsearch | |
import sys | |
from elasticsearch import helpers | |
import json | |
from slackclient import SlackClient | |
def search_brute_force(): | |
s = SlackClient("<Slack API Key here>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests,json | |
from pprint import pprint | |
def cymon_query(query,type): | |
api_key = "<You API Key here>" | |
if type == "ip": | |
url = "https://cymon.io/api/nexus/v1/ip/{}/events".format(query) | |
elif type == "domain": | |
url = "https://cymon.io/api/nexus/v1/domain/{}".format(query) | |
headers = {"authorization": "Token {}".format(api_key)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import ( | |
"fmt"; | |
"os"; | |
"bufio"; | |
) | |
func main() { | |
fmt.Print("Enter Password: "); |
OlderNewer