From 7783d171682ee247d1068555795374ac8fc3ca86 Mon Sep 17 00:00:00 2001 From: zwmccall <32351629+zwmccall@users.noreply.github.com> Date: Thu, 28 Sep 2017 00:06:43 -0500 Subject: [PATCH 01/29] Update Project2-age.py --- Project2-age.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project2-age.py b/Project2-age.py index 4633776..ea4bc6c 100644 --- a/Project2-age.py +++ b/Project2-age.py @@ -7,5 +7,5 @@ print('Hello') user_age = input('What is your age? \n') print('Oh so your age is', user_age) -years = input('Enter a numberto know your age after that many years \n') +years = input('Enter a number to know your age after that many years \n') print('You will be', int(years)+int(user_age), 'in', years ,'years') From 9af92d9119b33f60f9389c168b8b23fc346cfdaa Mon Sep 17 00:00:00 2001 From: Clayton Surfus Date: Thu, 28 Sep 2017 00:07:32 -0500 Subject: [PATCH 02/29] fixed a typo --- Project2-age.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project2-age.py b/Project2-age.py index 4633776..ea4bc6c 100644 --- a/Project2-age.py +++ b/Project2-age.py @@ -7,5 +7,5 @@ print('Hello') user_age = input('What is your age? \n') print('Oh so your age is', user_age) -years = input('Enter a numberto know your age after that many years \n') +years = input('Enter a number to know your age after that many years \n') print('You will be', int(years)+int(user_age), 'in', years ,'years') From edc7a5d80273e032973b0c33843bf03e9834285d Mon Sep 17 00:00:00 2001 From: Yogitha Polavarapu Date: Thu, 28 Sep 2017 11:00:13 +0530 Subject: [PATCH 03/29] twitter.py added script for extracting data from twitter --- twitter.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 twitter.py diff --git a/twitter.py b/twitter.py new file mode 100644 index 0000000..3efe66e --- /dev/null +++ b/twitter.py @@ -0,0 +1,22 @@ +''' +retrieves tweets from home +ofcourse! We will specify the limit +''' + +import tweepy +from tweepy import OAuthHandler +handle=open('tweets.txt','w') +# variables for keys +consumerKey = '' +consumerSecret = '' +accessToken = '' +accessSecret = '' +auth = tweepy.OAuthHandler(consumerKey, consumerSecret) +auth.set_access_token(accessToken, accessSecret) +api = tweepy.API(auth) +for status in tweepy.Cursor(api.home_timeline).items(100): + # Process a single status + print (status.text) + handle.write(status.text.encode('utf-8')) + handle.write('\n \n') +handle.close() From 87eee92d93ac9e29a62d3ca0d0571d8e0f58ddfc Mon Sep 17 00:00:00 2001 From: Yogitha Polavarapu Date: Thu, 28 Sep 2017 11:04:26 +0530 Subject: [PATCH 04/29] Update Project2-age.py typo change --- Project2-age.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project2-age.py b/Project2-age.py index 4633776..ea4bc6c 100644 --- a/Project2-age.py +++ b/Project2-age.py @@ -7,5 +7,5 @@ print('Hello') user_age = input('What is your age? \n') print('Oh so your age is', user_age) -years = input('Enter a numberto know your age after that many years \n') +years = input('Enter a number to know your age after that many years \n') print('You will be', int(years)+int(user_age), 'in', years ,'years') From a718ac66164ba0142d852eb220ad73904ba896c6 Mon Sep 17 00:00:00 2001 From: Yogitha Polavarapu Date: Thu, 28 Sep 2017 11:06:04 +0530 Subject: [PATCH 05/29] Update Project3-weeks_and_days(function).py typo error --- Project3-weeks_and_days(function).py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project3-weeks_and_days(function).py b/Project3-weeks_and_days(function).py index 7644653..4ea7d3b 100644 --- a/Project3-weeks_and_days(function).py +++ b/Project3-weeks_and_days(function).py @@ -1,6 +1,6 @@ #This is a function. def readable_timedelta(days): - """To get the number of weeks and days in given nuber of days""" + """To get the number of weeks and days in given number of days""" number_of_weeks = days // 7 #To get number of weeks number_of_days = days % 7 # To get number of days return('{} week(s) and {} day(s)'.format(number_of_weeks, number_of_days)) From c1501736f5ecb484a5e3a92ddb2284aec206c891 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 11:18:03 +0530 Subject: [PATCH 06/29] Create Project2-annoying_while_loop.py --- Project2-annoying_while_loop.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Project2-annoying_while_loop.py diff --git a/Project2-annoying_while_loop.py b/Project2-annoying_while_loop.py new file mode 100644 index 0000000..7af1aea --- /dev/null +++ b/Project2-annoying_while_loop.py @@ -0,0 +1,6 @@ +""" + A never ending while_loop which never terminates +""" + +while True: + print('Hello World') From d0d863dbb080d1a566a613df7be0bcab4541ad86 Mon Sep 17 00:00:00 2001 From: Marc-Anthony Taylor Date: Thu, 28 Sep 2017 08:04:59 +0200 Subject: [PATCH 07/29] Update Project3-weeks_and_days(function).py Altered formatting to better follow pep8. e.g. removed the unnecessary parens around the return value --- Project3-weeks_and_days(function).py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Project3-weeks_and_days(function).py b/Project3-weeks_and_days(function).py index 4ea7d3b..102fb10 100644 --- a/Project3-weeks_and_days(function).py +++ b/Project3-weeks_and_days(function).py @@ -1,7 +1,6 @@ -#This is a function. def readable_timedelta(days): """To get the number of weeks and days in given number of days""" - number_of_weeks = days // 7 #To get number of weeks - number_of_days = days % 7 # To get number of days - return('{} week(s) and {} day(s)'.format(number_of_weeks, number_of_days)) + number_of_weeks = days // 7 # To get number of weeks + number_of_days = days % 7 # To get number of days + return '{} week(s) and {} day(s)'.format(number_of_weeks, number_of_days) From c3181c73440320111aceecd9837f92ad0dc948d5 Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Thu, 28 Sep 2017 12:18:43 +0530 Subject: [PATCH 08/29] Add random_house.py --- random_house.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 random_house.py diff --git a/random_house.py b/random_house.py new file mode 100644 index 0000000..292ac3e --- /dev/null +++ b/random_house.py @@ -0,0 +1,15 @@ +""" +Author: Pranav Goel +Takes user's name as input and returns a random type of house they'll have when they grow up. +""" + + +import random + +future = ['bungalow','mansion','villa'] + +name = input("What is your name?\n") + +num = random.random()%3 + +print(name,", you'll have a ",future[int(num)]," when you grow up! :)") \ No newline at end of file From 9bfac180107be1cbe712dd1a96f9e2de2e5128bc Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Thu, 28 Sep 2017 12:43:23 +0530 Subject: [PATCH 09/29] Update README.md --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3a8f21f..c23c7f1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,9 @@ # Python_Projects -Contains projects made using Python 3.x. -You can contribute to this and make new projects. +Contains projects made using Python 3.x +Contribute to this repo by submitting fun and exciting projects. -Help me in improving my code - +Also, please help me in improving my code. Note: I am not a professional programmer I am still learning to code. - - From 3de098470c59b63f67db5519d99b779eb1d7b292 Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Thu, 28 Sep 2017 12:47:15 +0530 Subject: [PATCH 10/29] Add average_of_3_numbers.py --- average_of_3_numbers.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 average_of_3_numbers.py diff --git a/average_of_3_numbers.py b/average_of_3_numbers.py new file mode 100644 index 0000000..12e8ffb --- /dev/null +++ b/average_of_3_numbers.py @@ -0,0 +1,14 @@ +""" +Author: Pranav Goel +Takes three float numbers and returns their average +""" + +total = 0.0 +number1=float(input("Enter the first number: ")) +total = total + number1 +number2=float(input("Enter the second number: ")) +total = total + number2 +number3=float(input("Enter the third number: ")) +total = total + number3 +average = total / 3 +print ("The average is " + str(average)) \ No newline at end of file From 63902b4a66492e562af01e241b926ddd564c7490 Mon Sep 17 00:00:00 2001 From: Shubhangi Pandey Date: Thu, 28 Sep 2017 12:53:02 +0530 Subject: [PATCH 11/29] Update Project2-age.py --- Project2-age.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Project2-age.py b/Project2-age.py index ea4bc6c..66dbde0 100644 --- a/Project2-age.py +++ b/Project2-age.py @@ -5,7 +5,7 @@ print('Hello') -user_age = input('What is your age? \n') +user_age = int(input('What is your age? \n')) print('Oh so your age is', user_age) -years = input('Enter a number to know your age after that many years \n') -print('You will be', int(years)+int(user_age), 'in', years ,'years') +years = int(input('Enter a number to know your age after that many years \n')) +print('You will be',years+user_age, 'in', years ,'years') From 9b282a13e23393e2e8efac52f0b152221437dda2 Mon Sep 17 00:00:00 2001 From: Shubhangi Pandey Date: Thu, 28 Sep 2017 12:56:03 +0530 Subject: [PATCH 12/29] Create To reverse the case of a string --- To reverse the case of a string | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 To reverse the case of a string diff --git a/To reverse the case of a string b/To reverse the case of a string new file mode 100644 index 0000000..b91500d --- /dev/null +++ b/To reverse the case of a string @@ -0,0 +1,2 @@ +name= input() +print(name.swapcase()); From 2808155565b176d9ebf8a1f7664653ff18a19bb2 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 28 Sep 2017 08:27:21 +0100 Subject: [PATCH 13/29] Updating twitter.py Adding some syntax, comments, and properly defining some stuff for readability as well as adding user input :) --- twitter.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/twitter.py b/twitter.py index 3efe66e..0ef9023 100644 --- a/twitter.py +++ b/twitter.py @@ -5,18 +5,30 @@ import tweepy from tweepy import OAuthHandler -handle=open('tweets.txt','w') + +# Here be main +def main(): # variables for keys -consumerKey = '' -consumerSecret = '' -accessToken = '' -accessSecret = '' +consumerKey = input('Enter your consumer key: ') +consumerSecret = input('Enter your consumer secret: ') +accessToken = input('Enter your access token: ') +accessSecret = input('Enter your access secret: ') + +# OPEN ZE HANDLE +handle=open('tweets.txt','w') + +# Auth variables auth = tweepy.OAuthHandler(consumerKey, consumerSecret) auth.set_access_token(accessToken, accessSecret) api = tweepy.API(auth) + +# for status in tweepy.Cursor(api.home_timeline).items(100): # Process a single status print (status.text) handle.write(status.text.encode('utf-8')) handle.write('\n \n') handle.close() + +# Here be main starting its game +if __name__ == "__main__": main() From f4fd4df852e9847d7f983f4dbb6783dab126639a Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 28 Sep 2017 08:31:57 +0100 Subject: [PATCH 14/29] Create CONTRIBUTING.md --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4719ff9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,7 @@ +/* A list of contributers to this project (Github handles) */ + +Marwan2001 +yogithapolavarapu +csurfus +zwmccall +CrazyLlama From e209bce307169d4a9ae3d9c51d30009677887e5f Mon Sep 17 00:00:00 2001 From: Joan Albert Segura Date: Thu, 28 Sep 2017 09:50:19 +0200 Subject: [PATCH 15/29] O(n^2) sorting algorithms --- Project4-sorting_algorithms.py | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Project4-sorting_algorithms.py diff --git a/Project4-sorting_algorithms.py b/Project4-sorting_algorithms.py new file mode 100644 index 0000000..c156256 --- /dev/null +++ b/Project4-sorting_algorithms.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +""" +@author: jalbert +Implementation of three sorting algorithms with complexity 0(n^2) and the comparasion of time execution between them. +""" + +import random +from time import time + +lst = [random.randint(0, 200) for x in range(50)] + + +def bubble_sort(array): + + for i in range(len(array)): + for j in range(len(array)-1-i): + if array[j] > array[j+1]: + array[j], array[j+1] = array[j+1], array[j] + return array + +def insertion_sort(array): + + for i in range(len(array)): + j = i + while j > 0 and array[j] < array[j-1]: + array[j], array[j-1] = array[j-1], array[j] + j -= 1 + return array + +def selection_sort(array): + + for slot in range(len(array)-1,0,-1): + maxpos = 0 + for index in range(slot+1): + if array[index] > array[maxpos]: + maxpos = index + temp = array[slot] + array[slot] = array[maxpos] + array[maxpos] = temp + return array + + +t0 = time() +bubble_sort(lst) +ft0 = time() +elapsed0 = ft0 - t0 + +print "Bubble sort algorithm" +print "Execution time: %.10f sec" % (elapsed0) +print "===================================" + +t1 = time() +insertion_sort(lst) +ft1 = time() +elapsed1 = ft1 - t1 + +print "Insertion sort algorithm" +print "Execution time: %.10f sec" % (elapsed1) +print "===================================" + +t2 = time() +selection_sort(lst) +ft2 = time() +elapsed2 = ft2 - t2 + +print "Selection sort algorithm" +print "Execution time: %.10f sec" % (elapsed2) +print "===================================\n" + +algorithms = {'Bubble': elapsed0, 'Insertion': elapsed1, 'Selection': elapsed2} + +print "From best algorithm to worst:\n" +for key, value in sorted(algorithms.iteritems(), key=lambda (k,v): (v,k)): + print "%s: %s" % (key, value) + + + + + + + From 810a61093a0b23479043b5f421c2aaf6d2658445 Mon Sep 17 00:00:00 2001 From: Kevin Bai Date: Thu, 28 Sep 2017 18:21:01 +1000 Subject: [PATCH 16/29] Project2-annoying-while-loop.py update """More documentation""" --- Project2-annoying_while_loop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Project2-annoying_while_loop.py b/Project2-annoying_while_loop.py index 7af1aea..24b7b97 100644 --- a/Project2-annoying_while_loop.py +++ b/Project2-annoying_while_loop.py @@ -1,6 +1,9 @@ """ A never ending while_loop which never terminates """ - +""" + While True: + print("Hello World") +""" while True: print('Hello World') From aa8d6f56dc473ec5a95466eb0ae59c249ecc347f Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 14:29:51 +0530 Subject: [PATCH 17/29] Making the code more user friendly --- To reverse the case of a string | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/To reverse the case of a string b/To reverse the case of a string index b91500d..b3890e1 100644 --- a/To reverse the case of a string +++ b/To reverse the case of a string @@ -1,2 +1,2 @@ -name= input() +name= input('Enter a word to reverse the case of string \n') print(name.swapcase()); From 2bb98b2d77c8ed24b18dd7731065f69e1d01c4e3 Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Thu, 28 Sep 2017 14:35:40 +0530 Subject: [PATCH 18/29] Add fizzbuzz.py --- fizzbuzz.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 fizzbuzz.py diff --git a/fizzbuzz.py b/fizzbuzz.py new file mode 100644 index 0000000..debbcb0 --- /dev/null +++ b/fizzbuzz.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +def fizz_buzz(num): + if num % 15 == 0: + print("FizzBuzz") + elif num % 5 == 0: + print("Buzz") + elif num % 3 == 0: + print("Fizz") + else: + print(num) + +for i in range(1, 101): + fizz_buzz(i) + From f9040daef0891e356aafef886497e8b4244de015 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 14:37:47 +0530 Subject: [PATCH 19/29] Update CONTRIBUTING.md --- CONTRIBUTING.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4719ff9..9749290 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,4 @@ /* A list of contributers to this project (Github handles) */ +/*Add your name here*/ -Marwan2001 -yogithapolavarapu -csurfus -zwmccall -CrazyLlama +Marwan2001, yogithapolavarapu, csurfus, zwmccall, CrazyLlama From f26c30e8fe25d02f8a6054a8e350325069b77514 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 14:46:43 +0530 Subject: [PATCH 20/29] Update Project4-sorting_algorithms.py --- Project4-sorting_algorithms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Project4-sorting_algorithms.py b/Project4-sorting_algorithms.py index c156256..368c7dc 100644 --- a/Project4-sorting_algorithms.py +++ b/Project4-sorting_algorithms.py @@ -3,6 +3,7 @@ @author: jalbert Implementation of three sorting algorithms with complexity 0(n^2) and the comparasion of time execution between them. """ +#made using python 2 import random from time import time From 7264ed28dc755f73278f0c63e4c6aa1e0cd05b06 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 14:55:26 +0530 Subject: [PATCH 21/29] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c23c7f1..d235801 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,10 @@ Contribute to this repo by submitting fun and exciting projects. Also, please help me in improving my code. +We now have our own chat group click link bellow to join it. + +https://gitter.im/Python_Projects/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link + Note: I am not a professional programmer I am still learning to code. + + From 3c6d4ce9585e484aabec128f771e4bf87ab54736 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <31986276+Marwan2001@users.noreply.github.com> Date: Thu, 28 Sep 2017 19:24:07 +0530 Subject: [PATCH 22/29] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d235801..afe222a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # Python_Projects -Contains projects made using Python 3.x +Contains projects made using Python 3.x and a few Python 2.x (We prefer Python 3.x) Contribute to this repo by submitting fun and exciting projects. -Also, please help me in improving my code. +Also, please help us in improving us code. -We now have our own chat group click link bellow to join it. +### We now have our own chat group click link bellow to join it. https://gitter.im/Python_Projects/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link -Note: I am not a professional programmer I am still learning to code. +**Note: This is not made by professionals although few professionals might have contributed.** From 8b516c2e82b97ccec84673b8c16ffc97e18f2a7b Mon Sep 17 00:00:00 2001 From: kade killary Date: Thu, 28 Sep 2017 09:05:08 -0700 Subject: [PATCH 23/29] query google with keyword, open webbrowser with results --- google_searcher.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 google_searcher.py diff --git a/google_searcher.py b/google_searcher.py new file mode 100644 index 0000000..a561af2 --- /dev/null +++ b/google_searcher.py @@ -0,0 +1,25 @@ +import webbrowser +import sys +import pyperclip +import requests +import bs4 + + +def main(): + if len(sys.argv) > 1: + keyword = ' '.join(sys.argv[1:]) + else: + keyword = pyperclip.paste() + + res = requests.get('http://google.com/search?q=' + keyword) + res.raise_for_status() + soup = bs4.BeautifulSoup(res.text, "html.parser") + linkElems = soup.select('.r a') + numOpen = min(5, len(linkElems)) + + for i in range(numOpen): + webbrowser.open('http://google.com' + linkElems[i].get('href')) + + +if __name__ == '__main__': + main() From 971bd8066edbeb0f1f99cf23f0d11faa5b2d1460 Mon Sep 17 00:00:00 2001 From: Hargovind Singh Arora Date: Thu, 28 Sep 2017 23:38:13 +0530 Subject: [PATCH 24/29] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index afe222a..c45b180 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ Also, please help us in improving us code. ### We now have our own chat group click link bellow to join it. -https://gitter.im/Python_Projects/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link +[gitter link](https://gitter.im/Python_Projects/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link) + **Note: This is not made by professionals although few professionals might have contributed.** From f4db04b2840bca57cc6d75c957a9ab27e11fd0e7 Mon Sep 17 00:00:00 2001 From: HargovindArora Date: Thu, 28 Sep 2017 23:44:22 +0530 Subject: [PATCH 25/29] A python game using random --- random_game.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 random_game.py diff --git a/random_game.py b/random_game.py new file mode 100644 index 0000000..6f73c52 --- /dev/null +++ b/random_game.py @@ -0,0 +1,42 @@ +import random + +def get_guess(): + return list(input("What is Your Guess?")) + +def generate_code(): + digits = [str(num) for num in range(10)] + + random.shuffle(digits) + + return digits[:3] + +def generate_clues(code,user_guess): + clues = [] + if user_guess == code: + return "CODE CRACKED!" + + for ind,num in enumerate(user_guess): + if num == code[ind]: + clues.append("match") + elif num in code: + clues.append("Close") + + if clues == []: + return ["Nope"] + else: + return clues + +print ("Welcome Code Breaker!") + +secret_code = generate_code() + +clue_report = [] + +while clue_report != "CODE CRACKED!": + + guess = get_guess() + + clue_report = generate_clues(secret_code,guess) + print("here is the result of your guess:") + for clue in clue_report: + print(clue) From da548b03fae2ab916374e30695aea9d451519c23 Mon Sep 17 00:00:00 2001 From: jessufgit Date: Thu, 28 Sep 2017 19:46:34 -0400 Subject: [PATCH 26/29] Create battleship_by_first_timer_code --- battleship_by_first_timer_code | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 battleship_by_first_timer_code diff --git a/battleship_by_first_timer_code b/battleship_by_first_timer_code new file mode 100644 index 0000000..a206c49 --- /dev/null +++ b/battleship_by_first_timer_code @@ -0,0 +1,46 @@ +from random import randint + +board = [] + +for x in range(0, 5): + board.append(["O"] * 5) + +def print_board(board): + for row in board: + print " ".join(row) + +print_board(board) + +def random_row(board): + return randint(0, len(board) - 1) + +def random_col(board): + return randint(0, len(board[0]) - 1) + +ship_row = random_row(board) +ship_col = random_col(board) +print ship_row +print ship_col + +# Everything from here on should be in your for loop +# don't forget to properly indent! +for turn in range(4): + print "Turn", turn + 1 + guess_row = int(raw_input("Guess Row: ")) + guess_col = int(raw_input("Guess Col: ")) + + if guess_row == ship_row and guess_col == ship_col: + print "Congratulations! You sank my battleship!" + break + else: + if guess_row not in range(5) or \ + guess_col not in range(5): + print "Oops, that's not even in the ocean." + elif board[guess_row][guess_col] == "X": + print( "You guessed that one already." ) + else: + print "You missed my battleship!" + board[guess_row][guess_col] = "X" + if (turn == 3): + print "Game Over" + print_board(board) From 0f11e6497f325b928e744fd0ed087d837311ce95 Mon Sep 17 00:00:00 2001 From: Syed Marwan Jamal <2001smj24@gmail.com> Date: Fri, 29 Sep 2017 09:54:46 +0530 Subject: [PATCH 27/29] Update battleship_by_first_timer_code --- battleship_by_first_timer_code | 2 ++ 1 file changed, 2 insertions(+) diff --git a/battleship_by_first_timer_code b/battleship_by_first_timer_code index a206c49..6c8bdf6 100644 --- a/battleship_by_first_timer_code +++ b/battleship_by_first_timer_code @@ -1,3 +1,5 @@ +# Made using Python 2.x + from random import randint board = [] From 7f354c199d73ab680955fb02082deb93a3a2fe76 Mon Sep 17 00:00:00 2001 From: Yogitha Polavarapu Date: Sun, 21 Oct 2018 20:31:26 +0530 Subject: [PATCH 28/29] updated the comments --- twitter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/twitter.py b/twitter.py index 0ef9023..e82610e 100644 --- a/twitter.py +++ b/twitter.py @@ -14,15 +14,15 @@ def main(): accessToken = input('Enter your access token: ') accessSecret = input('Enter your access secret: ') -# OPEN ZE HANDLE +# OPEN the handle variable which acts like a cursor handle=open('tweets.txt','w') -# Auth variables +# Loading Auth variables auth = tweepy.OAuthHandler(consumerKey, consumerSecret) auth.set_access_token(accessToken, accessSecret) api = tweepy.API(auth) -# +# Cursor goes through each tweet and processes the status, limit is set to 100 for status in tweepy.Cursor(api.home_timeline).items(100): # Process a single status print (status.text) From 1f677b4d6c2d08ec071827f54ebfd01fbae871d6 Mon Sep 17 00:00:00 2001 From: Yogitha Polavarapu Date: Sun, 21 Oct 2018 20:32:15 +0530 Subject: [PATCH 29/29] changes to comments --- twitter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitter.py b/twitter.py index e82610e..c9bdadf 100644 --- a/twitter.py +++ b/twitter.py @@ -8,7 +8,7 @@ # Here be main def main(): -# variables for keys +# auth variables for keys consumerKey = input('Enter your consumer key: ') consumerSecret = input('Enter your consumer secret: ') accessToken = input('Enter your access token: ')