Skip to content
Open
16 changes: 15 additions & 1 deletion Awesome-Scripts/List of ideas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

4 changes: 3 additions & 1 deletion Awesome-Scripts/fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ def fib(n):


n = int(input("Enter a number: "))
print(fib(n))
print("Fibonacci series:")
for i in range(n):
print fib(n)
30 changes: 30 additions & 0 deletions Awesome-Scripts/hackernews.py
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions Awesome-Scripts/spiralmatrix.py
Original file line number Diff line number Diff line change
@@ -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<n:
matrix[r][c]=t
t=t+1
c=c+1
r=r+1
c=c-1
while r<n:
matrix[r][c]=t
t=t+1
r=r+1
r=r-1
c=c-1
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)
45 changes: 24 additions & 21 deletions Python-Syntax.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# Basic Python Syntax
## Python 2

1. Printing output in python 2 :-
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 wil give outout 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
- 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 befire 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(<var>, <type>)'
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(<var>, <type>)`
it accepts two parameter:
- variable name
- Type to be validated

example: isinstance(a, dict) , isinstance(num, integer)
It returns True if true else False.