Skip to content

Instantly share code, notes, and snippets.

View JagDecoded's full-sized avatar

Jagabandhu Sahoo JagDecoded

View GitHub Profile
@JagDecoded
JagDecoded / delete_screenshots.py
Last active August 29, 2017 14:18
I have a work Where I have to take a lot of screenshots. And I hate when I have to go and delete them one by one after selecting. So I wrote a python code to automate the deleting work.
# del C:\Users\HackMeBabe\Downloads\Screenshot*.png in command prompt thankz K900
import os
import re
regex=r'Screenshot \(?\d*\)?.png' #(.png|.jpg|.jpeg)
main_dir=os.getcwd()
i=0
os.chdir('C:/Users/HackMeBabe/Downloads') #put your directory here.
for file in os.listdir():
if re.findall(regex,file):
os.remove(file)
# Code written in PYTHON 3.6
# Cow & Bulls Game - a game where a 4 digit number will be generated automatically and user have to guess that number.
# For every perfectly guessed digit at perfect place user get a cow
# For every perfectly guessed digit at wrong place user get a Bull {Bull = Total matching digit - cows}
# game continues untill player guess the number exactly {4 cows} At the end the code will show how many guess count.
# Any improvement suggestion are welcome. Am a learner ready to Learn new things.
import random
import rockpaper
class Hero:
def __init__(self,name):
self.name=name
self.health=100
def eat(self,food):
if (food=='apple'):
self.health-=100
elif (food=='ham'):
import random
def password():
password_length=random.randint(8,18)
password_string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.*_!@#$%^&'
for i in range(1,password_length):
print (random.choice(password_string),end='')
def gen_another():
# Thank you ManyInterests(and reddit community) for suggestion and improving me. reddit link https://redd.it/6hu6k9
def rps_winner(p1_move,p2_move,player1_name,player2_name):
a= 'rock'
b= 'scissors'
c= 'paper'
if p1_move==p2_move:
print("tie")
elif (p1_move==a and p2_move==b) or (p1_move==b and p2_move==c) or (p1_move==c and p2_move==a):
num=int(input("enter the number to check all its divisior: "))
div_li=[]
for i in range(2,num):
if num%i==0:
div_li.append(i)
print(div_li)