- This event has passed.
5 PM – Intro To Java – Alex Lee
March 3, 2023 @ 5:00 pm - 6:00 pm
Homework
- Create a new project called Mar3Magic8Ball.java, and use a combination of Random module, while loop, if else statements to create Magic8Ball game.
- Look at below Python codes for your reference
-
-
import random while True: user_question = input("\nEnter your question? ") if user_question.lower() == "quit" or user_question.lower() == "exit": print("Bye bye") break random_num = random.randint(1, 8) if random_num == 1: print("It is certain") elif random_num == 2: print("Most likely.") elif random_num == 3: print("Signs point to yes.") elif random_num == 4: print("I don’t think so.") elif random_num == 5: print("Ask again later.") elif random_num == 6: print("Concentrate and ask again.") elif random_num == 7: print("Outlook not so good.") elif random_num == 8: print("My reply is no")
-
-