mine is print('\033[34m==\033[33mAnimal Farm\033[34m==\033[0m') uExit = '' while uExit != 'yes': animalInput = input('What animal do you want - cow, sheep, or duck? ').lower() if animalInput == 'cow': print('Moo 🐄 ') elif animalInput == 'sheep': print('bahh 🐏 ') elif animalInput == 'duck': print('quack 🦆 ') else: print("that's not a choice we've presented 😓 ") uExit = input('Do you want to exit? ' ).lower() if uExit == 'yes': print('Later! Have a lovely day 💖') Works nicely!
Short but basically giving the gist of the concept of the code exit = " " while exit != 'yes': ans = input("Which animal do you want ? : ") if ans == 'Cow': print("A Cow goes Moooo..!!") else: print("A ",ans," goes Awooga ?") print("") exit = input("Do you want to exit ? ") print("")
This is the correct code: I spent nearly 2 hours doing this, and I could not do it unless I saw Day 16: Animal='' while 'true': Animal=input('What animal do you want?') if Animal=='cow': print('A cow goes moo') elif Animal=='A lesser spotted lemur': print('Ummm...the lesser spotted lemur goes awooga') else: print('I dont know that animal, try again') exist=input('Do you want to exist?') if exist=='yes': break
This is the code I come up with: animals = "" while animals != "dog" and animals != "cat" and animals != "pig" and animals != "sheep" and animals != "horse": animals = input("What animals do you want?: ") if animals == "dog": print("Dog goes Woof! woof!") elif animals == "cat": print("Cat goes meow!") elif animals == "pig": print("Pig goes Oink! Oink!") elif animals == "sheep": print("Sheep goes baa! Baa!") elif animals == "horse": print("Horse goes neigh neigh! ") else: print() print(f'''{animals} is not on the list, you may choose between dog, cat, pig, sheep and horse''') print() exit = "" while exit != "yes" and exit != "exit": print("") exit = input("Exit?: ")
This what I found and am not sure if it's correct: Animal='' while 'true': Animal=input('What animal do you want?') if Animal=='cow': print('A cow goes moo') elif Animal=='A lesser spotted lemur': print('Ummm...the lesser spotted lemur goes awooga') exist=input('Do you want to exist?') else: print('I dont know that animal, try again') if exist =='yes': break
x = input("what animal do you want?: ") if x == "cow": print("moo") else: print("uhmmm, the",x,"says moooooo...?") y = input("do you want to exit?: ") while y != "yes": print("pls") y = input("do you want to exit?: ") if y == "yes": print(" :))))))")
i have written this code but what's wrong i cant understand? animal = input("what animal sound do u want? :") if animal == "cow" or animal == "goat": print("muhh") counter = 0 while counter
I took your code, changed some things around, cleaned it up a bit and managed to make it work. Rather than having multiple loops and if statements I wrapped a single if, elif and else statement in 1 single while loop. I also used a string instead of an int for your looping condition. Sorry, I wish I could explain this better but I'm still a noob lol, here's what I did, hope it makes sense to you. Good luck! exit = "" while exit != "yes" : animal = input("what animal sound do u want? :") if animal == "cow" or animal == "goat": print("muhh") elif animal == "lion" or animal == "tiger": print("roar") else: print("Sorry, please enter either cow, goat, lion, or tiger") exit = input("Would you like to exit?")
you need to add the keyword break in the end of your loops that it stop when it's true and it not show you the print of else , like this in your code : animal = input("what animal sound do u want? :") if animal == "cow" or animal == "goat": print("muhh") counter = 0 while counter
@@ayradizem2770 i am stuck in day 28 task plz have a look at this... import random import time import os #print("Battle Time ⚔") while True: def character(name, type): if type == 'human': return random.randint(50, 75) elif type == 'elf': return random.randint(75, 100) elif type == 'wizard': return random.randint(100, 125) elif type == 'orc': return random.randint(125, 150) name1 = input("Name ur Legend :") print(name1) type = input("Character type (human, elf ,wizard, orc) :") print(type) print() health = character(name1, type) print(f"{name1}'s health stats are {health}") strength = character(name1, type) print(f"{name1}'s strength stats are {strength}") print() print("Who are they Battling?") print() name2 = input("Name ur Legend :") print(name2) type = input("Character type (human, elf ,wizard, orc) :") print(type) print() health = character(name2, type) print(f"{name2}'s health stats are {health}") strength = character(name2, type) print(f"{name2}'s strength stats are {strength}") character("name", "type") os.system("clear") print() print("Let the battle Begin!!!") def ran_side_dice(): return random.randint() def char_health(): return ran_side_dice() * ran_side_dice() / 2 + 10 def char_strength(): return ran_side_dice() * ran_side_dice() / 2 + 12 def char_damage(): return ran_side_dice() * ran_side_dice() / 2 + 12 def return_stats(name1, name2): return (f"{name1}'s health is {health1} and strength is {strength1} and {name2}'s health is {health2} and strength is {strength2}") while True: # Roll one six-sided dice for both characters player1_dice = ran_side_dice() player2_dice = ran_side_dice() # The character who rolls the higher amount wins that round if player1_dice > player2_dice: print(f"{name1} wins this round!") # Take that amount away from the loser's health difference = abs(char_strength() - char_strength()) + 1 health -= difference if health player2_dice: print(f"{name1} wins this round!") # Take that amount away from the loser's health difference = abs(char_strength() - char_strength()) + 1 health -= difference if health player1_dice: print(f"{name1} loses this round!") difference = abs(char_strength() - char_strength()) + 1 health -= difference if health
# Day 15 exit=' ' while exit != 'y': print('') a = input('What animals do you want? ').lower() a=a.strip(" ") if a== 'cow': print('A cow goes muuuuh.') elif a == 'chicken': print('A chicken goes tok tok.') elif a == 'dog': print ('A dog goes Wuff wuff') else : print(' ') print('This animal name is not in my List') print(' ') exit= input('You want to finish ? y/n :') print('*** finished ***')
wrote a nice clean simple code for anyone needing an answer exit_game = '' while exit_game != 'no': #FIRST setup the exit Parameters animal = input ('
What animal do you want?:') if animal == 'cow': print (' A cow goes MOOOOOO') elif animal == 'lemur': print (' Ummm... a Lemur goes awoooooga') elif animal == 'dog': print (' A dog goes wuff wuff wuff') elif animal == 'duck': print (' A duck goes quackity quack') elif animal == 'cat': print (' A cat goes MEOOOOW') else: print (' I am sorry I do not know what that sound that animal makes Please try something different :)!!') exit_game = input ('
Would you like to try another animal?') if exit_game == 'no': print('Later! Have a great day')
print("\033[32m","WELCOME TO THE ZOO!""\033[0m") exit = "" while exit != "yes": animal = input("Which animal do you choose? We have Dog, Cow, and Cat. ") if animal == "Dog": print("A dog goes gau gau") elif animal == "Cow": print("A cow goes moo") elif animal == "Cat": print("A cat goes meow meow") else: print("We don't have this animal here") exit = input("Do you want to exit? ") if exit == "yes": print("Bye bye! See you!");
I tried this adding a bit more: lista = ["gato","perro"] lista_2 = ["Meoow meoow meoow","Woof woof woof"] animales = "" while animales != lista[0] and animales != lista[1]: animales = input("Ingresa un animal para escuchar su sonido: ") print() if animales == lista[0]: print("{}".format(lista_2[0])) elif animales == lista[1]: print("{}".format(lista_2[1])) else: print() print("El animal {} no se encuentra en el listado, intenta con gato o perro".format(animales)) print() finalizar = "" while finalizar != "si" and finalizar != "no": print() finalizar = input("Deseas finalizar?: ") if finalizar == "si": print() print("Adios!") else: print() finalizar_2="" while finalizar_2 != "no" and finalizar_2 !="si": finalizar_2 = input("¿Quieres saber algo curioso?") print() if finalizar_2 == "si": print("La base de la física cuántica nos dice que no podemos saber simultáneamente la velocidad y posición de una partícula con precisión. Esto rompe con la idea determinista que todo puede ser predecido. Para ello se realizan varias predicciones y al final se saca una probabilidad de un evento") print("Adios!!") elif finalizar_2 == "no": print("Adioooos!")
I am really loving this series. Building projects with fun comedy. Currently on Day 15. Thank you Replit and also bald man David haha😁😁
ty replit
you roasted David or smth?
Probably the longest I've ever held interest in something other than playing games
. Started with some programming when i was 14 but never got the hang of it. I have now revisited my dream of wanting to code and having so much fun 🤩
mine is
print('\033[34m==\033[33mAnimal Farm\033[34m==\033[0m')
uExit = ''
while uExit != 'yes':
animalInput = input('What animal do you want - cow, sheep, or duck? ').lower()
if animalInput == 'cow':
print('Moo 🐄 ')
elif animalInput == 'sheep':
print('bahh 🐏 ')
elif animalInput == 'duck':
print('quack 🦆 ')
else:
print("that's not a choice we've presented 😓 ")
uExit = input('Do you want to exit? ' ).lower()
if uExit == 'yes':
print('Later! Have a lovely day 💖')
Works nicely!
Short but basically giving the gist of the concept of the code
exit = " "
while exit != 'yes':
ans = input("Which animal do you want ? : ")
if ans == 'Cow':
print("A Cow goes Moooo..!!")
else:
print("A ",ans," goes Awooga ?")
print("")
exit = input("Do you want to exit ? ")
print("")
enjoy the way u present the tutorial.... feel enjoy, happy, n relax
For the loop, you can also use
mysum = 0
for i in range(1,1001):
mysum = mysum + i
print(mysum)
(1,1001 is just an example.)
This is the correct code:
I spent nearly 2 hours doing this, and I could not do it unless I saw Day 16:
Animal=''
while 'true':
Animal=input('What animal do you want?')
if Animal=='cow':
print('A cow goes moo')
elif Animal=='A lesser spotted lemur':
print('Ummm...the lesser spotted lemur goes awooga')
else:
print('I dont know that animal, try again')
exist=input('Do you want to exist?')
if exist=='yes':
break
This is the code I come up with:
animals = ""
while animals != "dog" and animals != "cat" and animals != "pig" and animals != "sheep" and animals != "horse":
animals = input("What animals do you want?: ")
if animals == "dog":
print("Dog goes Woof! woof!")
elif animals == "cat":
print("Cat goes meow!")
elif animals == "pig":
print("Pig goes Oink! Oink!")
elif animals == "sheep":
print("Sheep goes baa! Baa!")
elif animals == "horse":
print("Horse goes neigh neigh! ")
else:
print()
print(f'''{animals} is not on the list,
you may choose between dog, cat, pig, sheep and horse''')
print()
exit = ""
while exit != "yes" and exit != "exit":
print("")
exit = input("Exit?: ")
he didn't teach us %-formatting 😠
Thank you so much! It was a little hard but not too hard! I had lots of fun!
Great job!
exit = "NO"
while exit == "NO":
animal = input("what animal do you want? ")
if animal == "dog" or animal == "Dog":
print("Woof")
elif animal == "cat":
print("miua")
else:
print ("I don't know that animal")
exit = input("Exit?: ")
Best toothy smile in the entire kingdom
print('Farm Game')
print()
exit = ""
while exit != "yes":
animal = input('Choose an animal: ')
if animal == "dog":
print('Bark bark 🐶')
elif animal == "cat":
print('Miaaau 🐱')
elif animal == "cow":
print('Muuuu 🐮')
else:
print('Animal out of the list, choose between dog, cat or cow')
print()
exit = input('Do you wanna exit? ')
print()
print('Thanks for playing')
This what I found and am not sure if it's correct:
Animal=''
while 'true':
Animal=input('What animal do you want?')
if Animal=='cow':
print('A cow goes moo')
elif Animal=='A lesser spotted lemur':
print('Ummm...the lesser spotted lemur goes awooga')
exist=input('Do you want to exist?')
else:
print('I dont know that animal, try again')
if exist =='yes':
break
animal_sounds = {
'Cow': 'moo',
'Bird': 'tweet',
'Cat': 'meow',
'Lion': 'roar',
'Rat': 'squeak'
}
while True:
animal = input("What animal would you like to hear?: ").capitalize()
if animal in animal_sounds:
print (f"A {animal} goes {animal_sounds[animal]}")
regen = input("Generate new sound? (yes/no): ").lower()
if regen == "no":
print ("Program Ending...")
break
x = input("what animal do you want?: ")
if x == "cow":
print("moo")
else:
print("uhmmm, the",x,"says moooooo...?")
y = input("do you want to exit?: ")
while y != "yes":
print("pls")
y = input("do you want to exit?: ")
if y == "yes":
print("
:))))))")
i have written this code but what's wrong i cant understand?
animal = input("what animal sound do u want? :")
if animal == "cow" or animal == "goat":
print("muhh")
counter = 0
while counter
I took your code, changed some things around, cleaned it up a bit and managed to make it work. Rather than having multiple loops and if statements I wrapped a single if, elif and else statement in 1 single while loop. I also used a string instead of an int for your looping condition. Sorry, I wish I could explain this better but I'm still a noob lol, here's what I did, hope it makes sense to you. Good luck!
exit = ""
while exit != "yes" :
animal = input("what animal sound do u want? :")
if animal == "cow" or animal == "goat":
print("muhh")
elif animal == "lion" or animal == "tiger":
print("roar")
else:
print("Sorry, please enter either cow, goat, lion, or tiger")
exit = input("Would you like to exit?")
you need to add the keyword break in the end of your loops that it stop when it's true and it not show you the print of else , like this in your code :
animal = input("what animal sound do u want? :")
if animal == "cow" or animal == "goat":
print("muhh")
counter = 0
while counter
@@ayradizem2770 i am stuck in day 28 task plz have a look at this...
import random
import time
import os
#print("Battle Time ⚔")
while True:
def character(name, type):
if type == 'human':
return random.randint(50, 75)
elif type == 'elf':
return random.randint(75, 100)
elif type == 'wizard':
return random.randint(100, 125)
elif type == 'orc':
return random.randint(125, 150)
name1 = input("Name ur Legend :")
print(name1)
type = input("Character type (human, elf ,wizard, orc) :")
print(type)
print()
health = character(name1, type)
print(f"{name1}'s health stats are {health}")
strength = character(name1, type)
print(f"{name1}'s strength stats are {strength}")
print()
print("Who are they Battling?")
print()
name2 = input("Name ur Legend :")
print(name2)
type = input("Character type (human, elf ,wizard, orc) :")
print(type)
print()
health = character(name2, type)
print(f"{name2}'s health stats are {health}")
strength = character(name2, type)
print(f"{name2}'s strength stats are {strength}")
character("name", "type")
os.system("clear")
print()
print("Let the battle Begin!!!")
def ran_side_dice():
return random.randint()
def char_health():
return ran_side_dice() * ran_side_dice() / 2 + 10
def char_strength():
return ran_side_dice() * ran_side_dice() / 2 + 12
def char_damage():
return ran_side_dice() * ran_side_dice() / 2 + 12
def return_stats(name1, name2):
return (f"{name1}'s health is {health1} and strength is {strength1} and {name2}'s health is {health2} and strength is {strength2}")
while True:
# Roll one six-sided dice for both characters
player1_dice = ran_side_dice()
player2_dice = ran_side_dice()
# The character who rolls the higher amount wins that round
if player1_dice > player2_dice:
print(f"{name1} wins this round!")
# Take that amount away from the loser's health
difference = abs(char_strength() - char_strength()) + 1
health -= difference
if health player2_dice:
print(f"{name1} wins this round!")
# Take that amount away from the loser's health
difference = abs(char_strength() - char_strength()) + 1
health -= difference
if health player1_dice:
print(f"{name1} loses this round!")
difference = abs(char_strength() - char_strength()) + 1
health -= difference
if health
@@vineetrathod94 I'm just in 17 days then when I will arrived to 28 days I will see your code
# Day 15
exit=' '
while exit != 'y':
print('')
a = input('What animals do you want? ').lower()
a=a.strip(" ")
if a== 'cow':
print('A cow goes muuuuh.')
elif a == 'chicken':
print('A chicken goes tok tok.')
elif a == 'dog':
print ('A dog goes Wuff wuff')
else :
print(' ')
print('This animal name is not in my List')
print(' ')
exit= input('You want to finish ? y/n :')
print('*** finished ***')
This is my code for the daily challenge. Am I doing it correctly?:
animal = ""
while animal != "cow":
print("a cow goes moo")
animal = input("What animal do you want ?: ")
if animal == "dog":
print("dog goes woof")
elif animal == "bird":
print("chip chip")
elif animal == "goat":
print("bah bah")
else:
print("have no idea what they sound like!")
exit == ""
while exit != "no":
print("no")
exit = input("do you want to exit?: ")
animal = ""
while animal != "lesser spotted lemur":
print("Ummm...the Lesser Spotter Lemur goes awooga.")
animal= input("What animal do you want?: ")
if animal == "donkey":
print("hee haw!")
elif animal == "baboon":
print("hoot hoot!")
elif animal == "pig":
print("oink oink!")
else:
print("sorry, can't imitate their noises!")
Hi small question 😊. Can someone explain to me why in the first bit of code we write '+=1'? And why simply writing '+1' doesn't work
the = is meant to reassign a new value to the counter variable! so you're adding 1 and reassigning the value all in one step with +=1
heres mine without the exit
animal = input("What animal would you like to hear: ")
if animal == "cow":
print("MOOO: ")
if animal == "Cow":
print("MOOO: ")
if animal == "Pig":
print("Oink Oink: ")
if animal == "pig":
print("Oink Oink: ")
if animal == "sheep":
print("Bheee: ")
if animal == "Sheep":
print("Bheee: ")
if animal == "Horse":
print("Huuuh huuh: ")
if animal == "horse":
print("Bheee: ")
if animal == "snake":
print("szzz szzz: ")
if animal == "Snake":
print("szzz szzz: ")
if animal == "Dog":
print("rugh rugh: ")
if animal == "dog":
print("rugh rugh: ")
if animal == "Cat":
print("Miao Miao: ")
if animal == "Cat":
print("Miao Miao: ")
wrote a nice clean simple code for anyone needing an answer
exit_game = ''
while exit_game != 'no': #FIRST setup the exit Parameters
animal = input ('
What animal do you want?:')
if animal == 'cow':
print ('
A cow goes MOOOOOO')
elif animal == 'lemur':
print ('
Ummm... a Lemur goes awoooooga')
elif animal == 'dog':
print ('
A dog goes wuff wuff wuff')
elif animal == 'duck':
print ('
A duck goes quackity quack')
elif animal == 'cat':
print ('
A cat goes MEOOOOW')
else:
print ('
I am sorry I do not know what that sound that animal makes
Please try something different :)!!')
exit_game = input ('
Would you like to try another animal?')
if exit_game == 'no':
print('Later! Have a great day')
3:25 what happened there?
Well, this one was slightly easier. Although David almost crashed his computer
print("\033[32m","WELCOME TO THE ZOO!""\033[0m")
exit = ""
while exit != "yes":
animal = input("Which animal do you choose? We have Dog, Cow, and Cat. ")
if animal == "Dog":
print("A dog goes gau gau")
elif animal == "Cow":
print("A cow goes moo")
elif animal == "Cat":
print("A cat goes meow meow")
else:
print("We don't have this animal here")
exit = input("Do you want to exit? ")
if exit == "yes":
print("Bye bye! See you!");
How do I add the emoji in my code like that
On Windows, hold down your "Windows" key then press full stop key ".", the emoji window will popup
I tried 100,000. It took forever to end
I tried this adding a bit more:
lista = ["gato","perro"]
lista_2 = ["Meoow meoow meoow","Woof woof woof"]
animales = ""
while animales != lista[0] and animales != lista[1]:
animales = input("Ingresa un animal para escuchar su sonido: ")
print()
if animales == lista[0]:
print("{}".format(lista_2[0]))
elif animales == lista[1]:
print("{}".format(lista_2[1]))
else:
print()
print("El animal {} no se encuentra en el listado, intenta con gato o perro".format(animales))
print()
finalizar = ""
while finalizar != "si" and finalizar != "no":
print()
finalizar = input("Deseas finalizar?: ")
if finalizar == "si":
print()
print("Adios!")
else:
print()
finalizar_2=""
while finalizar_2 != "no" and finalizar_2 !="si":
finalizar_2 = input("¿Quieres saber algo curioso?")
print()
if finalizar_2 == "si":
print("La base de la física cuántica nos dice que no podemos saber simultáneamente la velocidad y posición de una partícula con precisión. Esto rompe con la idea determinista que todo puede ser predecido. Para ello se realizan varias predicciones y al final se saca una probabilidad de un evento")
print("Adios!!")
elif finalizar_2 == "no":
print("Adioooos!")
consulta el determinismo de laplace, (ta bonito tu código)