Skip to content

Instantly share code, notes, and snippets.

View msaisushma's full-sized avatar

Sai Sushma S M msaisushma

  • Zeomega
  • Bangalore
View GitHub Profile
@msaisushma
msaisushma / user settings in sublime
Created June 9, 2014 10:33
Sublime whitespace error fix
{
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true
}
@msaisushma
msaisushma / Algorithm.txt
Last active May 9, 2019 18:21
Algorithm and Python code for a typical two players Snakes and Ladders game.
Algorithm for snakes and Ladders game in python
1)There are two players and they are given a dice
2)Typically the game board has 100 cells starting from 1 to 100
3)There are snakes and ladders in different cells. And each has either a ladder or a snake or nothing but not both snake and ladder in the same cell.
4)I use two python dictionaries namely 'snakes' and 'ladders' to declare the positions of snakes and ladders.
5)I make starting cell number of snake or ladder as 'key' and ending cell number as 'value' of the dictionary.
6)Define a function to roll the dice i.e., accepting the input from Player1 and Player2 with a checking condition of dice number to be between 1 & 6.
7)Define a function to check if Player1 or Player2 found ladder or a snake mouth.
8)Check for the 'key's in both dictionaries & proceed accordingly.
9)The rolling of dice continues until any of the player reaches above 99, if any of the players reach 100 they will be declared as winner of the game.
""".....code for the bus tracking system by the help of pyramid frame work....."""
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from sqlalchemy import create_engine
from busroutes import BusRoute
from busroutes import Base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
""".....code for the bus tracking system by the help of pyramid frame work....."""
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from sqlalchemy import create_engine
from busroutes import BusRoute
from busroutes import Base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
Base = declarative_base()
class BusRoute(Base):
__tablename__ = 'busroutes'
bus_no = Column(Integer, primary_key=True)
start_point = Column(String(100))
end_point = Column(String(100))
bin
include
lib
def fib():
a,b,c,l,n=-1,1,0,[],int(raw_input("enter the end of series:"))
for i in range(n+1):
c=a+b
b,a=c,b
l.append(c)
n1=int(raw_input("enter the position:"))
print l[n1-1]
if __name__=='__main__':