From d80aad363c410cc90213dff3d0f723194951a4fb Mon Sep 17 00:00:00 2001 From: HarshadNarayane Date: Tue, 13 Dec 2016 17:54:46 +0530 Subject: [PATCH 1/9] Create Try.py --- Harshad-s Folder/Try.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Harshad-s Folder/Try.py diff --git a/Harshad-s Folder/Try.py b/Harshad-s Folder/Try.py new file mode 100644 index 0000000..ad35e5a --- /dev/null +++ b/Harshad-s Folder/Try.py @@ -0,0 +1 @@ +print("Hello World") From 6d802e290a343227493d5f2f8ebd603c87ee2f2e Mon Sep 17 00:00:00 2001 From: Rohan Date: Tue, 13 Dec 2016 17:58:35 +0530 Subject: [PATCH 2/9] Create folder2 --- Folder1/folder2 | 1 + 1 file changed, 1 insertion(+) create mode 100644 Folder1/folder2 diff --git a/Folder1/folder2 b/Folder1/folder2 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Folder1/folder2 @@ -0,0 +1 @@ + From c6ce76b226e9ec4a4ba96c29acc4113c0ade9dd5 Mon Sep 17 00:00:00 2001 From: Daidipya Date: Tue, 13 Dec 2016 18:05:04 +0530 Subject: [PATCH 3/9] Create iugh.py --- fojgder/iugh.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 fojgder/iugh.py diff --git a/fojgder/iugh.py b/fojgder/iugh.py new file mode 100644 index 0000000..1396069 --- /dev/null +++ b/fojgder/iugh.py @@ -0,0 +1 @@ +lkjklnjklj From c6169c5e81fdceabd1564cd5cd8fb2f518d88f56 Mon Sep 17 00:00:00 2001 From: salonikajale Date: Wed, 14 Dec 2016 10:55:49 +0530 Subject: [PATCH 4/9] 8 queens no 2 queens can be in the same column,row or digonal. --- 8q.json | 11 +++++++++++ 8q.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 8q.json create mode 100644 8q.py diff --git a/8q.json b/8q.json new file mode 100644 index 0000000..b5c2226 --- /dev/null +++ b/8q.json @@ -0,0 +1,11 @@ +{"matrix": [ + + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [1, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0]]} + diff --git a/8q.py b/8q.py new file mode 100644 index 0000000..688a32c --- /dev/null +++ b/8q.py @@ -0,0 +1,38 @@ +import json +inf=open("8q.json") +board=json.loads(inf.read()) +board=board["matrix"] +for i in board: + print(i) +def issafe(row,col): + for i in range(8): + for j in range(8): + if(board[i][j]==1): #if a queen exists here, then check if it attacks our queen + if(row==i): + return False + if(col==j): + return False + if(abs(row-i)==abs(col-j)): + return False + return True + +def place(col): + if(col>=8): #if all 8 queens are placed, then finish + print("\t\tCompleted...") + return True + for i in range(8): #checking for all rows in that column + if(issafe(i,col)): #is it safe? + board[i][col]=1 #queen is placed here + if(place(col+1)==True): #recursive call to place next queen + return True + board[i][col]=0 #if not placed, then backtrack, i.e it sets to zero and the loop iterates to check for next position + return False +if(place(1)==True): + print("solution found") +else: + print("Solution not possible") +for i in board: + print(i) + + + From 3c86d524f9ec02bdc14548953432ece97e76f2b1 Mon Sep 17 00:00:00 2001 From: Rohan Date: Thu, 15 Dec 2016 11:51:25 +0530 Subject: [PATCH 5/9] Firsy gui pytho Program Textbox, buttons, label --- Gui/tp.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Gui/tp.py diff --git a/Gui/tp.py b/Gui/tp.py new file mode 100644 index 0000000..cfdd874 --- /dev/null +++ b/Gui/tp.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +from Tkinter import * +top = Tk(className="First GUI") +foo = Label(top,text="This is just a label!!!") +foo.pack() + +def act(): + print "Button pressed!!!" +f1 = Button(top,text="Press ME",command=act) +f1.pack() + +str = StringVar() +inputbox = Entry(top,textvariable=str) +inputbox.pack() +def act1(): + print "you entered %s" % str.get() +btn1 = Button(top,text="Get Me", command=act1) +btn1.pack() + + + + + +top.mainloop() + + From ee3a20a85ecee9b89bbfe8ac2e1a7810154199f9 Mon Sep 17 00:00:00 2001 From: Daidipya Date: Tue, 10 Jan 2017 07:16:12 +0530 Subject: [PATCH 6/9] Add files via upload Guess mu Number game . --- GuessMyNumber.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 GuessMyNumber.py diff --git a/GuessMyNumber.py b/GuessMyNumber.py new file mode 100644 index 0000000..879a94a --- /dev/null +++ b/GuessMyNumber.py @@ -0,0 +1,23 @@ +import random +print "Welcome to the game : Guess My Number" +range="1 to 10" +num = random.randint(1,10) +#print num +while True: + + userNum = int(input("Guess the number in "+range+": ")) + if userNum>num: + print "Number is high" + else: + if userNum Date: Sat, 14 Jan 2017 08:52:23 +0530 Subject: [PATCH 7/9] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..70163e5 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# PythonTest +This repo to hone your python skills From 3a4b39a7ecb338f7eb70ece95c326fe809c54d40 Mon Sep 17 00:00:00 2001 From: Daidipya Date: Sat, 14 Jan 2017 08:53:39 +0530 Subject: [PATCH 8/9] Mad Lib Generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Goal: Inspired by Summer Son’s Mad Libs project with Javascript. The program will first prompt the user for a series of inputs a la Mad Libs. For example, a singular noun, an adjective, etc. Then, once all the information has been inputted, the program will take that data and place them into a premade story template. You’ll need prompts for user input, and to then print out the full story at the end with the input included. Concepts to keep in mind:  Strings  Variables  Concatenation  Print A pretty fun beginning project that gets you thinking about how to manipulate user inputted data. Compared to the prior projects, this project focuses far more on strings and concatenating. Have some fun coming up with some wacky stories for this --- MadLibsGenerator.py | 206 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 MadLibsGenerator.py diff --git a/MadLibsGenerator.py b/MadLibsGenerator.py new file mode 100644 index 0000000..939c677 --- /dev/null +++ b/MadLibsGenerator.py @@ -0,0 +1,206 @@ +""" +Created By : Daidipya +Mad Libs generator with GUI using Python +""" + +from Tkinter import* +import random + + +# to display story +def displayStory(): + global win1 + quit(win) + win1=Tk() + win1.title("YOUR STORY") + frame1 = Frame(win1) + frame1.pack() + story = StringVar() + randomInt = random.randint(1,10) + story = getStory(str(randomInt)) + L1 = Label(frame1 , text=story) + L1.grid(row=0, column=0,sticky=W) + + submitButton1= Button(frame1, text="Do It Again!!", width=10 , command=switchWindow) + submitButton1.grid(row=2, column=1 ,sticky=W) + + win1.mainloop() + +# returns random story +def getStory(storyNo): + noun1Txt = noun1.get() + nounPTxt = nounP.get() + noun2Txt = noun2.get() + noun3Txt = noun3.get() + placeTxt = place.get() + adjectiveTxt = adjective.get() + return { + '1': "Be kind to your "+noun1Txt+" -footed "+nounPTxt+"\n For a duck may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is always " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '2' : "Be random to your "+noun1Txt+" -footed "+nounPTxt+"\n For a rat may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is not always " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '3': "Be clear to your "+noun1Txt+" -footed "+nounPTxt+"\n For a mice may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is many times " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '4' : "Be killer to your "+noun1Txt+" -footed "+nounPTxt+"\n For a goat may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is closly " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '5': "Be cool to your "+noun1Txt+" -footed "+nounPTxt+"\n For a fort may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is about " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '6' : "Be smart to your "+noun1Txt+" -footed "+nounPTxt+"\n For a god may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is slow " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '7': "Be free to your "+noun1Txt+" -footed "+nounPTxt+"\n For a creature may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is always " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '8' : "Be tough to your "+noun1Txt+" -footed "+nounPTxt+"\n For a animal may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is very well " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '9': "Be Sad to your "+noun1Txt+" -footed "+nounPTxt+"\n For a crow may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather is not well " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + '10' :"Be Happy to your "+noun1Txt+" -footed "+nounPTxt+"\n For a cat may be somebody`s "+noun2Txt+" \n Be "+ noun3Txt +" to your Legs in "+ placeTxt + +" Where the weather may be " + adjectiveTxt + "\n You may think that this is the Knee Brace, Well it is" , + }[storyNo] + +def switchWindow(): + quit(win1) + displayGetWordsScreen() + +def quit(win): + win.destroy() + +def getRandomNoun(number): + return { + '1': 'people' , + '2': 'history' , + '3': 'way' , + '4': 'art', + '5': 'world' , + '6': 'information', + '7': 'map' , + '8': 'two', + '9': 'family' , + '10': 'government', + }[number] + +def getRandomNounP(number): + return { + '1': 'bacteria' , + '2': 'brothers' , + '3': 'children' , + '4': 'elves', + '5': 'confetti' , + '6': 'phenomena', + '7': 'tuna' , + '8': 'Ninja', + '9': 'Goods' , + '10': 'Pens', + }[number] + +def getRandomPlce(number): + return { + '1':'CapeTown' , + '2':'Pune', + '3':'London', + '4':'Canada', + '5':'US', + '6':'Manmad', + '7':'Chennai', + '8':'Banglore', + '9':'Hydrabad', + '10':'Delhi', + }[number] + +def getRandomAdjective(number): + return { + '1':'active', + '2':'better', + '3':'junior', + '4':'nocturnal', + '5':'precious', + '6':'plastic', + '7':'rotten', + '8':'sympathetic', + '9':'wrong', + '10':'webbed', + }[number] + +def resetText(): + randomInt = random.randint(1,10) + clearEntry(E2) + E2.insert(0, getRandomNoun(str(randomInt))) + clearEntry(E3) + E3.insert(0, getRandomNounP(str(random.randint(1,10)))) + clearEntry(E4) + E4.insert(0, getRandomNoun(str(random.randint(1,10)))) + clearEntry(E5) + E5.insert(0, getRandomPlce(str(randomInt))) + clearEntry(E6) + E6.insert(0, getRandomAdjective(str(randomInt))) + clearEntry(E7) + E7.insert(0, getRandomNoun(str(random.randint(1,10)))) + +def clearEntry(Entry): + Entry.delete(0, 'end') + + + +def displayGetWordsScreen(): + global noun1,noun2,nounP,place,noun3,adjective,win ,E2,E3,E4,E5,E6,E7 + win=Tk() + win.title("MAD LIBS") + randomInt = random.randint(1,10) + + frame = Frame(win) + frame.pack() + + L1 = Label(frame , text="Mad Libs Game") + L1.grid(row=0, column=0,sticky=W) + + L2 = Label(frame, text="NOUN") + L2.grid(row=1,column=0,sticky=W) + noun1 =StringVar() + E2=Entry(frame,textvariable=noun1) + E2.grid(row=1,column=1,sticky=W) + + + L3 = Label(frame, text="NOUN(PLURAL)") + L3.grid(row=2,column=0,sticky=W) + nounP =StringVar() + E3=Entry(frame,textvariable=nounP) + E3.grid(row=2,column=1,sticky=W) + + + L4 = Label(frame, text="NOUN") + L4.grid(row=3,column=0,sticky=W) + noun2 =StringVar() + E4=Entry(frame,textvariable=noun2) + E4.grid(row=3,column=1,sticky=W) + + + L5 = Label(frame, text="PLACE") + L5.grid(row=4,column=0,sticky=W) + place =StringVar() + E5=Entry(frame,textvariable=place) + E5.grid(row=4,column=1,sticky=W) + + + L6 = Label(frame, text="ADJECTIVE") + L6.grid(row=5,column=0,sticky=W) + adjective =StringVar() + E6=Entry(frame,textvariable=adjective) + E6.grid(row=5,column=1,sticky=W) + + + L7 = Label(frame, text="NOUN") + L7.grid(row=6,column=0,sticky=W) + noun3 =StringVar() + E7=Entry(frame,textvariable=noun3) + E7.grid(row=6,column=1,sticky=W) + + + + submitButton1= Button(frame, text="Go Mad!", width=10 ,command=displayStory) + submitButton1.grid(row=7, column=1 ,sticky=W) + randomButton= Button(frame, text="Totaly Random", width=10 ,command=resetText) + randomButton.grid(row=7, column=2 ,sticky=W ) + + win.mainloop() + +displayGetWordsScreen() + From 354f592249d8ab68eac803796ba00485c93aedf9 Mon Sep 17 00:00:00 2001 From: Daidipya Date: Sat, 14 Jan 2017 08:57:54 +0530 Subject: [PATCH 9/9] Bubble Sort My first program in Python , Bubble Sort --- untitled-1.py => Bubble_Sort_By_DT-1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename untitled-1.py => Bubble_Sort_By_DT-1.py (99%) diff --git a/untitled-1.py b/Bubble_Sort_By_DT-1.py similarity index 99% rename from untitled-1.py rename to Bubble_Sort_By_DT-1.py index 2f30a56..74a8119 100644 --- a/untitled-1.py +++ b/Bubble_Sort_By_DT-1.py @@ -19,4 +19,4 @@ - \ No newline at end of file +