American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

4 PM – Intro To Java – Gamas

November 5, 2022 @ 4:00 pm - 5:00 pm

Homework
  1. In Nov5Magic8Ball.java, use combination of Random module, while loop, if else statements to create Magic 8 Ball game.
  2. Look at below Python codes for your reference
  3. 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")

Details

Date:
November 5, 2022
Time:
4:00 pm - 5:00 pm
Event Categories:
,
Verified by MonsterInsights