Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

code academy magic 8 bal code python

import random

name = "Jose"

question = "Will I get another dog named Naruto?"

answer = ""

random_number = random.randint(1,9)

#print(random_number)

if random_number == 1:

  print("Yes - definitely.")

elif random_number == 2:

  print("It is decidely so.")

elif random_number == 3:

  print("Without a doubt.")

elif random_number == 4:

  print("Reply hazy, try again.")

elif random_number == 5:

  print("Ask again later.")

elif random_number == 6:

  print("Better not tell you now.")

elif random_number == 7:

  print("My sources say no.")

elif random_number == 8:

  print("Outlook not so good.")

elif random_number == 9:

  print("Very doubtful.")

else:

  answer = "Error"

  

  print(name + " asks; " + question)

  print("Magic 8-Ball's answer:" + answer)
Comment

PREVIOUS NEXT
Code Example
Python :: python combine images horizontally next to each other 
Python :: passing list vs int in python important 
Python :: jdoodle python 
Python :: travers a list 
Python :: how to move mouse by detected face and eye using opencv 
Python :: python create empty list with size 10 
Python :: python sumproduct excel 
Python :: get complete path from reletive path python 
Python :: pyt last of range of numbers 
Python :: pandas iloc stack overflow 
Python :: Python NumPy broadcast_to() Function Syntax 
Python :: Python NumPy moveaxis function Example 
Python :: how to change the color of console output in python to green 
Python :: python dictionary examples 
Python :: Python NumPy asarray_chkfinite Function Syntax 
Python :: Python NumPy array_split Function Example 02 
Python :: Python NumPy tile Function Example when (repetitions == arr.ndim) == 0 
Python :: retinaface detection 
Python :: object at being output python 
Python :: funcs_and_args for loop python 
Python :: NumPy packbits Code Packed array along axis 1 
Python :: pandas aggregate rename column 
Python :: downgrading to previous migration django 
Python :: extract numbers from image python 
Python :: SQL Query results in tkinter 
Python :: store dataframes 
Python :: decoding to str: need a bytes-like object, list found 
Python :: How do I pre-select specific values from a dynamically populated dropdown list for HTML form 
Python :: typing effect in python 
Python :: postgres fecth python 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =