Share your repls and programming experiences

← Back to all posts
Magic 8 ball
dilshaan (15)

Do you want and answer to one of your yes or no question? Then you can try out this Magic 8 ball game to know your true answer.

Comments
hotnewtop
JosephSanthosh (1182)

import os
import random, curses, sys, time
from time import sleep

st = 0.04
def sp1(str):
for letter in str:
sys.stdout.write(letter)
sys.stdout.flush()
time.sleep(0.06)
print()

black = "\033[0;30m"
red = "\033[0;31m"
green = "\033[0;32m"
yellow = "\033[0;33m"
blue = "\033[0;34m"
magenta = "\033[0;35m"
cyan = "\033[0;36m"
white = "\033[0;37m"
bright_black = "\033[0;90m"
bright_red = "\033[0;91m"
bright_green = "\033[0;92m"
bright_yellow = "\033[0;93m"
bright_blue = "\033[0;94m"
bright_magenta = "\033[0;95m"
bright_cyan = "\033[0;96m"
bright_white = "\033[0;97m"

You just need to copy paste this anywhere to add color to your text or have the typewriter effect.
For color you do this:
print(bright_cyan + "Text will be bright cyan")

For typewriter effect you do this:
sp1("Put the sp1 to have the typewriter effect")

These are the main decoratives you can add, which I already added.

dilshaan (15)

@JosephSanthosh For some reason, the typewritter thing would not work. Is it okay if you add that into the code? And thank you for the idea!!!

JosephSanthosh (1182)

I did it's all added into the code! @dilshaan

JosephSanthosh (1182)

IF YOU LIKED IT AND LEARNT SOMETHING NEW THEN PLEASE UPVOTE ALL THESE COMMENTS! THANK YOU AND IF YOU EVER NEED HELP JUST PING OR ASK ME.

@dilshaan

dilshaan (15)

@JosephSanthosh For some reason, the typewritter effect is not working for me. Is there any specific placement for it? And how exactly can i ping you. Sorry, i am new to this stuff.

JosephSanthosh (1182)

Did you copy paste the exact same code, including the import packages. Invite me into the post if you need any help. BTW pinging is this '@JosephSanthosh' (just putting your name with the '@' in front of it). invite me if you need anything. @dilshaan

dilshaan (15)

@JosephSanthosh Ya i think so. Can you go into my code and fix it? And i just invited you into the code.

JosephSanthosh (1182)

I just saw it, I'll invite you to mine. @dilshaan

dilshaan (15)

@JosephSanthosh Okay, Thank You for the help!

JosephSanthosh (1182)

Your welcome. Could you do me a favor of upvoting all these coments? Thank you @dilshaan

JosephSanthosh (1182)

YAY! Could you do me a favor of upvoting all these comments?

@dilshaan

dilshaan (15)

Do you know how to change the background color?

JosephSanthosh (1182)

Thx. You can't change background color, only text. @dilshaan

JosephSanthosh (1182)

Ur welcome, ask me if you ever need help! @dilshaan

dilshaan (15)

@JosephSanthosh Yes i upvoted all of the comments now!!!!!

JosephSanthosh (1182)

Could I help you make it look better?

dilshaan (15)

@JosephSanthosh Hi, not to make this sound rude but how do you mean by making it look better?

JosephSanthosh (1182)

Decorate, is that fine with you. @dilshaan

dilshaan (15)

@JosephSanthosh Do you know how exactly i can decorate it? Because i have not done any decorating in repl.it yet. Oh, and thank you for giving me the idea of making it decorative!!!

dilshaan (15)

@JosephSanthosh Yes you may for the question you asked above!

JosephSanthosh (1182)

Thanks I'll teach you also. @dilshaan

JosephSanthosh (1182)

Do this on python 3 not pygame, it will look nicer.