From 6f452abbb9477c0be244d00f2d70b420d988949e Mon Sep 17 00:00:00 2001 From: Michael Jenkins Date: Wed, 25 Oct 2017 15:13:26 -0700 Subject: [PATCH 1/8] Initial check in --- Awesome-Scripts/hackernews.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 Awesome-Scripts/hackernews.py diff --git a/Awesome-Scripts/hackernews.py b/Awesome-Scripts/hackernews.py new file mode 100755 index 0000000..5f1c8d9 --- /dev/null +++ b/Awesome-Scripts/hackernews.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +from __future__ import print_function +import requests +from bs4 import BeautifulSoup + +# get the front page from hacker news +response = requests.request("GET", "https://news.ycombinator.com/") + +# convert the response to soup +soup = BeautifulSoup(response.text, "lxml") + +# count the things that get processed +count = 0 + +# process all of the things! :D +for things in soup("tr", { "class" : "athing" }): + # get at the rank of each thing + for rank in things("span", { "class" : "rank" }): + print( rank.text, end=' ' ) + + # get the title of each thing + for title in things("a", { "class" : "storylink" }): + print( title.text ) + print( title['href'] ) + print( " " ) + + count = count + 1 + + if count == 10: break From 8071d37c0f68f0e4c3d53090c5feffd9dbabd2bd Mon Sep 17 00:00:00 2001 From: Shail Sheth Date: Thu, 26 Oct 2017 23:32:23 +0530 Subject: [PATCH 2/8] Update List of ideas.md Also changed the file name of Rolling dice. --- Awesome-Scripts/List of ideas.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Awesome-Scripts/List of ideas.md b/Awesome-Scripts/List of ideas.md index 025aaaf..27ff76c 100644 --- a/Awesome-Scripts/List of ideas.md +++ b/Awesome-Scripts/List of ideas.md @@ -36,4 +36,18 @@ It plays morse code (audio) depending on users' entered string. ### 14. The number game that insults you if you get it wrong with entries in a file. ### 15. [Bitcoin price tracker GUI](luno_btc_price.py) A GUI that shows Bitcoin price with a button that can refresh to the current price. -~ +### 16. [Rolling a Dice](Rolling_Dice.py) +A Simple Script that Rolls a dice. +### 17. [Chat Server](chat_serv.py) +Server for Multithreaded Chat application. +### 18. [Exponentiation](exponentiation.py) +To Get Precised exponent of desired Float Number. +### 19. [Fibonacci](fibonacci.py) +A simple fibonacci script. +### 20. [Port Scanner](port_scanner.py) +Simple Port Scanner to check whether port 80 available or not. +### 21. [File Renamer](toRenamer.py) +This program renames a list of tv episodes. Episodes can be nested inside folders. folders will be flattened and episodes renamed to a particular format. +### 22. [Reddit Scrapping.py](reddit_scrapping.py) +Scrapper for Reddit. + From e08b1bff23329b7427a3364d3109b285aa471cc2 Mon Sep 17 00:00:00 2001 From: Kaushik Jaiswal <16ucc046@lnmiit.ac.in> Date: Fri, 27 Oct 2017 12:31:51 +0530 Subject: [PATCH 3/8] Create Web Scraping Using Python --- Web Scraping Using Python | 1 + 1 file changed, 1 insertion(+) create mode 100644 Web Scraping Using Python diff --git a/Web Scraping Using Python b/Web Scraping Using Python new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Web Scraping Using Python @@ -0,0 +1 @@ + From 03415fffa0cbae2fa20ba8cc9aa4e236e2fc6897 Mon Sep 17 00:00:00 2001 From: Kaushik Jaiswal <16ucc046@lnmiit.ac.in> Date: Fri, 27 Oct 2017 12:34:01 +0530 Subject: [PATCH 4/8] Delete Web Scraping Using Python --- Web Scraping Using Python | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Web Scraping Using Python diff --git a/Web Scraping Using Python b/Web Scraping Using Python deleted file mode 100644 index 8b13789..0000000 --- a/Web Scraping Using Python +++ /dev/null @@ -1 +0,0 @@ - From 0f3701a3bdc09b0f8d3091f52a312685124f32ee Mon Sep 17 00:00:00 2001 From: Naman Kumar Garg <31842804+Naman-Garg-06@users.noreply.github.com> Date: Sat, 28 Oct 2017 00:47:44 +0530 Subject: [PATCH 5/8] earlier it was not printing the sequence. It was just returning one value. --- Awesome-Scripts/fibonacci.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Awesome-Scripts/fibonacci.py b/Awesome-Scripts/fibonacci.py index e0a6fd0..b9d76ea 100644 --- a/Awesome-Scripts/fibonacci.py +++ b/Awesome-Scripts/fibonacci.py @@ -8,4 +8,6 @@ def fib(n): n = int(input("Enter a number: ")) -print(fib(n)) \ No newline at end of file +print("Fibonacci series:") +for i in range(n): + print fib(n) From 964856c7bf4792a6b8169d9eb2557802656d226d Mon Sep 17 00:00:00 2001 From: Naman Kumar Garg <31842804+Naman-Garg-06@users.noreply.github.com> Date: Sat, 28 Oct 2017 20:11:54 +0530 Subject: [PATCH 6/8] Print using single quotes. A statement can be printed using single quotes too. Also there were some spelling errors. --- Python-Syntax.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Python-Syntax.md b/Python-Syntax.md index 4825c85..97c55cc 100644 --- a/Python-Syntax.md +++ b/Python-Syntax.md @@ -2,20 +2,21 @@ ## Python 2 1. Printing output in python 2 :- - print "argument that you want to print" + print "argument that you want to print" OR + print 'argument that you want to print' 2. mathematical operators :- x = 8 y = 4 - print x+y # it wil give outout of sum of x and y + print x+y # it will give output of sum of x and y print x-y # it will give difference of x and y print x/y # it will give quotient when x is divided by y print x%y # it is modulo function and gives remainder when x is divied by y - print x ** y # it means x^y. it is way to represnt power operator + print x ** y # it means x^y. it is way to represent power operator 3. single line comments can be given by putting # before a line - 4. multi line comments can be given by putting 3 double quotes befire and after the lines. + 4. multi line comments can be given by putting 3 double quotes before and after the lines. example of putting multiline comments is : """ hello From f366ad06e78753209188d4c559f93c25af141bbd Mon Sep 17 00:00:00 2001 From: Naman Kumar Garg <31842804+Naman-Garg-06@users.noreply.github.com> Date: Mon, 30 Oct 2017 16:42:18 +0530 Subject: [PATCH 7/8] Spiral Matrix.py --- Awesome-Scripts/spiralmatrix.py | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Awesome-Scripts/spiralmatrix.py diff --git a/Awesome-Scripts/spiralmatrix.py b/Awesome-Scripts/spiralmatrix.py new file mode 100644 index 0000000..d19891b --- /dev/null +++ b/Awesome-Scripts/spiralmatrix.py @@ -0,0 +1,41 @@ +n=int(input("Enter the size of matrix:")) +t=1 +r=0 # r stands for row +c=0 # c stands for column +matrix=[[0 for x in range(n)]for y in range(n)] # to initialise the matrix +if n%2==0: + k=n/2 +else: + k=(n/2)+1 +for i in range(k): + while c=i: + matrix[r][c]=t + c=c-1 + t=t+1 + c=c+1 + r=r-1 + while r>i: + matrix[r][c]=t + t=t+1 + r=r-1 + r=r+1 + n=n-1 + c=c+1 +for m in matrix: + print m + ln = "" + for i in m: + ln += str(i) + " " + print(ln) \ No newline at end of file From 1bde911c2eb6ff42e52a97694dacf053958ddf57 Mon Sep 17 00:00:00 2001 From: Naman Kumar Garg <31842804+Naman-Garg-06@users.noreply.github.com> Date: Thu, 2 Nov 2017 20:21:05 +0530 Subject: [PATCH 8/8] Update Python-Syntax.md --- Python-Syntax.md | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Python-Syntax.md b/Python-Syntax.md index 97c55cc..dccc790 100644 --- a/Python-Syntax.md +++ b/Python-Syntax.md @@ -1,30 +1,32 @@ # Basic Python Syntax ## Python 2 -1. Printing output in python 2 :- - print "argument that you want to print" OR - print 'argument that you want to print' +- Printing output in **Python 2** :- + `print "argument that you want to print"` + OR + `print 'argument that you want to print'` -2. mathematical operators :- - x = 8 - y = 4 - print x+y # it will give output of sum of x and y - print x-y # it will give difference of x and y - print x/y # it will give quotient when x is divided by y - print x%y # it is modulo function and gives remainder when x is divied by y - print x ** y # it means x^y. it is way to represent power operator +- Mathematical operators :- + >`x = 8` + >`y = 4` + >`print x + y` # it will give output of sum of x and y + >`print x - y` # it will give difference of x and y + >`print x / y` # it will give quotient when x is divided by y + >`print x % y` # it is modulo function and gives remainder when x is divied by y + >`print x ** y` # it means x^y. it is way to represent power operator - 3. single line comments can be given by putting # before a line + - Single line comments can be given by putting **#** before a line - 4. multi line comments can be given by putting 3 double quotes before and after the lines. + - Multi line comments can be given by putting 3 double quotes before and after the lines. - example of putting multiline comments is : - """ hello - how are you """ + example of putting multiline comments is : + **""" hello + how are you """** - 5. To validate a variable to be an integer or a string, use 'isinstance(, )' - it accepts two parameter - 1. variable name - 2. Type to be validated - example: isinstance(a, dict) , isinstance(num, integer) - It return True if true else false. + - To validate a variable to be an integer or a string, use `isinstance(, )` + it accepts two parameter: + - variable name + - Type to be validated + + example: isinstance(a, dict) , isinstance(num, integer) + It returns True if true else False.