Skip to content

Commit

Permalink
familytree added
Browse files Browse the repository at this point in the history
  • Loading branch information
thenu97 committed Feb 25, 2020
1 parent 43c09f8 commit 78cd50d
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 0 deletions.
File renamed without changes.
25 changes: 25 additions & 0 deletions familytree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3.8

class Person():
def __init__(self, name, title, children=None):
self.name = name
self.title = title
if children is None:
self.children = []
else:
self.children = children

def desc(self):
out = []
for kid in self.children:
out.append(kid)
out.extend(kid.desc())
return out

p1 = Person("p1", "test")
p2 = Person("p2", "test", children = [p1])
p3 = Person("p3", "test")
p4 = Person("p4", "test", children = [p2, p3])
p5 = Person("p5", "boss", children = [p4])
print [person.title for person in p5.desc()]
print [person.name for person in p5.desc()]
13 changes: 13 additions & 0 deletions fizzfuzz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3.8

def fizzbuzz(number):
if number % 3 == 0:
x = print("fizz")
elif number % 5 == 0:
x = print("buzz")
else:
pass
return x


fizzbuzz(6)
102 changes: 102 additions & 0 deletions hangman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env python3.8
import random
import sys


# lets set some variables
wordList = [
"lion", "umbrella", "window", "computer", "glass", "juice", "chair", "desktop",
"laptop", "dog", "cat", "lemon", "cabel", "mirror", "hat"
]

guess_word = []
secretWord = random.choice(wordList) # lets randomize single word from the list
length_word = len(secretWord)
alphabet = "abcdefghijklmnopqrstuvwxyz"
letter_storage = []



def beginning():
print("Hello Mate!\n")

while True:
name = input("Please enter Your name\n").strip()

if name == '':
print("You can't do that! No blank lines")
else:
break

beginning()



def newFunc():
print("Well, that's perfect moment to play some Hangman!\n")

while True:
gameChoice = input("Would You?\n").upper()

if gameChoice == "YES" or gameChoice == "Y":
break
elif gameChoice == "NO" or gameChoice == "N":
sys.exit("That's a shame! Have a nice day")
else:
print("Please Answer only Yes or No")
continue

newFunc()



def change():

for character in secretWord: # printing blanks for each letter in secret word
guess_word.append("-")

print("Ok, so the word You need to guess has", length_word, "characters")

print("Be aware that You can enter only 1 letter from a-z\n\n")

print(guess_word)



def guessing():
guess_taken = 1

while guess_taken < 10:


guess = input("Pick a letter\n").lower()

if not guess in alphabet: #checking input
print("Enter a letter from a-z alphabet")
elif guess in letter_storage: #checking if letter has been already used
print("You have already guessed that letter!")
else:

letter_storage.append(guess)
if guess in secretWord:
print("You guessed correctly!")
for x in range(0, length_word): #This Part I just don't get it
if secretWord[x] == guess:
guess_word[x] = guess
print(guess_word)

if not '-' in guess_word:
print("You won!")
break
else:
print("The letter is not in the word. Try Again!")
guess_taken += 1
if guess_taken == 10:
print(" Sorry Mate, You lost :<! The secret word was", secretWord)


change()
guessing()

print("Game Over!")

Empty file added ksjfhkjg.py
Empty file.
8 changes: 8 additions & 0 deletions removehash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python3.8



def to_camel_case(text):
return print(list(text.split("-")))

to_camel_case("the_stealth_warrior")

0 comments on commit 78cd50d

Please sign in to comment.