Skip to content

Instantly share code, notes, and snippets.

View letsintegreat's full-sized avatar

letsintegreat

  • India
View GitHub Profile
@letsintegreat
letsintegreat / explaination.js
Created January 6, 2019 02:28
Here is the solution source code (well-commented) for #1 Classic Cookie Challenge.
// Cookie, or just say input
const cookie = [
[1, 0, 0, 1, 0],
[1, 0, 1, 0, 0],
[0, 0, 1, 0, 1],
[1, 0, 1, 0, 1],
[1, 0, 1, 1, 0]
];
// A Two-dimensional array to store the coordinates that have been checked.
@letsintegreat
letsintegreat / factorial.py
Last active December 6, 2018 14:18
Code written under an event called Google Code-in.
# Method to calculate factorial of the number passed as a parameter using recursion.
def fact(num):
if num <= 1:
return 1
return num * fact(num - 1) * 1.00
try:
print('Enter a number: ') # Message to display on screen
# I'm casting the entered string into float because if the entered number is 5.0 then it raises a ValueError,