Skip to content
Sign UpLog In
Profile icon

Alexander Alexander

@AlexanderLuna
gr8 news
Repls
Community
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Input/if, else related question...
Even when the person gets the password wrong they still get to play the game...
If, elif, and else based guess the number.
Python
CodingCactus
CodingCactus
you need to put the whole code in the if indent for it to only be run if they get the username/password right see https://repl.it/@CodingCactus/If-elif-and-else-based-guess-the-number pls ask questions of unsure3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Whats wrong with line 55? Whats wrong with line 55? Whats wrong with line 55?
If, elif, and else based guess the number.
Python
TheForArkLD
TheForArkLD
while(option2=="No"): add colon. (probably,it’s loop.)3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
I made it so the program asks if they want to ply a game. When the person types yes the code keeps repeating non stop.
If, elif, and else based guess the number.
Python
TheForArkLD
TheForArkLD
add this to end game option="No" And probably,i found incorrect code. Yes = input("Do you want to play a game: ") Change this to option = input("Do you want to play a game: ") ~3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Can anyone tell me whats wrong with line 18?
If, elif, and else based guess the number.
Python
AlexanderLuna
AlexanderLuna
nvm3 years ago
TheForArkLD
TheForArkLD
Hmmm?probably no wrong3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
The slowprint comes out like this: Welcome to guess the number.There will be there rounds.This i s round 1. I'm think of a number 1 through 10. Your g
If, elif, and else based guess the number.
Python
AlexanderLuna
AlexanderLuna
@MrEconomical Thanks!3 years ago
eco27
eco27
you can print a new line after each slowprint just do print("\n")3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Can anyone tell me how to make everything after line 9 shorter?
If, elif, and else based guess the number.
Python
UniqueOstrich18
UniqueOstrich18
I've shortened the program to 17 lines: print("Welcome to guess the number.") print("There will be three rounds.") print("This is round 1.") print("(If your guess is incorrect run the code again.)") print("I'm thinking of a number 1 through 10.") def make_guess(number): guess = int(input("Your guess: ")) if number == guess: print("Correct!") else: print("Incorrect...") numbers = [7,4,6] counter = 0 for number in numbers: counter = counter + 1 print("Round "+ str(counter)) mak3 years ago
Codejira
Codejira
def tell_player(): print("Correct") if num == var else print("Incorrect") Also line 9 will raise a SyntaxError. Delete it. One of the greatest benefits of functions is that they can be used several times. Define one at the top of your code and call it whenever needed.3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Can anyone tell me how to make all the text print as "slowprint"?
AlexanderLuna
AlexanderLuna
thanks for the help everyone3 years ago
xolyon
xolyon
here is a function I made a while back import os import sys import time def SlowPrint(text,ti): for char in text: sys.stdout.write(char) sys.stdout.flush() #change this to print to print vertically time.sleep(ti) `3 years ago
AraAra
AraAra
from os import system, name import sys def sprint(str): for c in str + '\n': sys.stdout.write(c) sys.stdout.flush() time.sleep(0.0821) sprint("your text goes here")3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
Anyone know whats wrong with line 24???
Random games!
Python
AlexanderLuna
AlexanderLuna
and thanks3 years ago
AlexanderLuna
AlexanderLuna
ok<, I will3 years ago
BlueComet
BlueComet
The problem is on line 23 you need a closing ) for your print function. Hope this helps3 years ago
AlexanderLuna
AlexanderLuna
shared a Post
3 years ago
My script so far: import random print ("(Player 1's choice is the top one and player 2's is the bottom.)") #makes name player1pick = "" player2pick =
Random games!
Python