Channel your inner porpoise.
I am working on a text adventure and when I put in one number all of the things that would happen when it is put in are called at once. (；'⌒') Will yo
brogen I have the problem resolved.3 years ago
RYANTADIPARTHI You have too many if statements. Try elifs too. And indent everything. IT seems you are not indenting everything properly.3 years ago
Coder100 Make sure you have indented everything correctly.3 years ago
I want to try to play a sound but I don't know how.
GABELACANLALE Very good question. from replit import audio audio.playfile('myfile.mp3')3 years ago
brogen This question will remain unsolved. ;(3 years ago
brogen My teacher looked and there's no way to do it. 3 years ago
I want to make a eating contest you can enter in and I need to know how to do chance statements. 🐷🐖🐽 Pigs are the best! You can play the game now
DynamicSquid You can use a random number generator for that import random num = random() # generate random decimal between 0 and 1 if num < 0.5: do something else: do something `3 years ago
This is a game where you would train up dogs and sell them. However after you train once you can't train again. Please help me find out why.
Bookie0 Hi, I think the reason why is because you're asking if they want to train or sell in the if loop with the training. A code where you can always train your dog would look a bit like this:, using functions: def train(): # defining the train function print("Rolling over") print("playing with toy") etc. put all the other code for the training here while True: # infinity loop to always go on and on menu = input("What do you want to do? train - 50 or sell?") if menu == "train" and money 3 years ago
realTronsi You have two main functions?!3 years ago
Help me debug this plz. please help.
Coder100 ok, on line 40, why do you have two arguments when it takes 0? habachi.describerestaurant(name, dishtype) Correct code habachi.describe_restaurant() ig you overthought it lol3 years ago
littlepenguin You did not define name yet. If you define it, it will work.3 years ago
I want to be able to do something every set amount of time. like every second get one dollar from your buisiness.
Coder100 sure, try something like this: import time while True: print("Time is ten seconds.") time.sleep(10) Do note that means any code after it won't get executed import time while True: print("Time is ten seconds.") time.sleep(10) print("I never happen") `3 years ago
Whacko while True: dollars += 1 time.sleep(1) There. *Remember, you need time imported.3 years ago
I want to try and use the data base for a project to have a password set up and you can input the password and that password is asighned to you foreve
Coder100 Try something like: from replit import db input('sign up? (y/n): ') if signup == 'y': username = input('username: ') password = input('password: ') db[username] = password else: username = input('username: ') password = input('password: ') if (db[username] == password): print('welcome %s!' % username) `3 years ago
techde Fork this:https://repl.it/@templates/Django-Template#README.md3 years ago
techde Real has a starter template for it that I suggest you check out!3 years ago
How can I erase a symbol and replace it with a new one?
you see the stairs right? are they going left or right?
happy holidays! If you like christmas upvote also you can comment down below and talk
it might not be to exilerating but t it's my first project. you may change the symbols in the printing to make different patterns.
brogen ok thank you!3 years ago
DynamicSquid Cool! You also don't need brackets: if i != "\n" and i != ":":3 years ago
i want to be able to print patters on something typed in. help! please.
brogen i want to be able to print something when you type in a command for example.3 years ago
Ronnoc72 You can use a GUI, pygame is a fantastic way to visual see your code.3 years ago
PattanAhmed @brogen Hi, Can you please explain a little bit more for our Clarification! Thanks!3 years ago
i need to go slowly instead of putting the whole thing on at once.
PattanAhmed @brogen Hi, Here is the code you can try:- It will print Letter-by-Letter import time,sys def typewriter(message): for i in message: sys.stdout.write(i) sys.stdout.flush() if ((i != "\n") and (i != ":")): time.sleep(0.09) else: time.sleep(0.6) text = 'Letter-by-letter' typewriter(text) Thanks! Hope this helps3 years ago
Coder100 Hi! Try this: import time def typewriter(text, delay=0.1): for letter in text: print(letter, end='', flush=True) time.sleep(delay) print() typewriter("I'm being typed at a rate of 0.1 seconds") typewriter("I'm being typed at a rate of 0.05 seconds", 0.05) `3 years ago
brogen thank you3 years ago
how do i make infinite loops i need to know for a printing project!
PattanAhmed @brogen Hi, Use something called While Loop:- Code:- while True: print('This will print infinite times') Thanks! Hope this helps3 years ago
brogen can you tell me how to print slowly like typing instead of printing the whole thing really fast3 years ago
Coder100 You can use a while loop for that: while True: print("hi!") read more here Also, btw use break to end the loop3 years ago