Skip to content

Instantly share code, notes, and snippets.

@hahalim
hahalim / triangle.py
Last active December 27, 2018 00:04
Asterisk triangle
chance = ""
while(chance!="no"):
try:
num = int(input("Enter the number of rows "))
for i in range(1, num+1):
for j in range(num-i, num):
print("*", end="")
print()
except ValueError:
print("Enter the valid number")
@hahalim
hahalim / guessgame.py
Last active December 27, 2018 16:47
Guess the number game
import random
win = 0
tries =0
count = 3
print ("Let's Play 'GUESS THE NUMBER' Game!")
ans = input("Are you ready to play? [yes/no] ")
while ans.lower() != "no":
print("I'm thinking number from 1 to 10, Guess It in 3 tries ")
guess = random.randint(1,10)
for count in range (3,0,-1):
@hahalim
hahalim / fizzbuzz.py
Created December 25, 2018 11:37
FIZZBUZZ Solution
chance = ""
while (chance!="no"):
try:
num = int(input("Please enter a number\n"))
if (num%5==0 and num%3==0):
print("FizzBuzz")
elif (num%5 == 0):
print("BUZZ")
elif (num%3 == 0):
print("FIZZ");