Python Forum
my first attempt, please advise me of any thing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my first attempt, please advise me of any thing
#1
My first bit of code, I've only just started to learn, I understand this is very basic but this is the best way I learn.

I'm not sure how this should look but its how it currently looks, I'm just about to apply a tkinkler GUI and have it displaying, and then add some form of scoreboard.

please be as critical as possible, AND any advise on something else I could build as very basic although to learn, thanks.

import random
from tkinter import *


answer = random.randint(2, 25)

two = "4 / 2", "a baby conceive two years and nine months ago, the answer is the baby's age. ", "864 - 482 - 380 ="
three = "426 / 142 =", "1098 - 685 - 410 =", "3 * 1 ="
four = "2 Squared", "793 - 406 - 383 =", "2 * 2 ="
five = "4596 - 102 - 4489 =", "30 / 6 =", "1 * 5 ="
six = "28 - 16 - 6 =", "3 * 2 =", "10 / 2"
seven = "56 - 7 - 42 =", "0.7 * 10 = ", "63 / 9 ="
eight = "2 Cube", "36 - 12 - 16 =", "55 / 7 ="
nine = "3 Squared", "586 - 428 - 149 =", "99 / 11 ="
ten = "586 - 926 - 350 =", "80 / 8 =", "10 * 1 ="
eleven = "312 - 52 - 249 =", "121 / 11 = 11", "5.5 * 2 ="
twelve = "Medium of 9, 12, 7, 16 and 13", "456 - 215 - 229 =", "144 / 12 ="
thirteen = "844 - 726 - 105 =", "6.5 * 2 =", "6 + 7 ="
fourteen = "652 - 486 - 152 =", "7 * 2 = ", "3.5 * 4 ="
fifteen = "986 - 785 - 186 =", "10 + 5 =", "5 * 2 ="
sixteen = "4 Square", "786 - 582 - 188 =", "4 * 4 ="
seventeen = "147 - 52 - 78 =", "8 + 9 =", "3.4 * 5 ="
eighteen = "3874 - 3772 - 3754 =", "3 / 6 =", "2.25 * 8 ="
nineteen = "10528 - 7854 - 2655 =", "4.75 * 4 =", "1216 / 64 ="
twenty = "206 - 150 - 36 =", "5 * 4 =", "100 / 5 ="
twenty_one = "478 - 264 - 193 =", "7 * 3 =", "7 / 3 ="
twenty_two = "9875 - 5248 - 4605 =", "5.5 * 4 =", "352 / 16 ="
twenty_three = "548 - 321 - 23 =", "5.75 * 4 =", "368 / 16 ="
twenty_four = "457 - 326 - 107 =", "6 * 4 =", "8 * 3 ="
twenty_five = "5 Squared", "The highest number in our quiz", "if you * this number by 5 you will get 125"


if answer == 2:
        print(random.choice(two))
if answer == 3:
        print(random.choice(three))
if answer == 4:
        print(random.choice(four))
if answer == 5:
        print(random.choice(five))
if answer == 6:
        print(random.choice(six))
if answer == 7:
        print(random.choice(seven))
if answer == 8:
        print(random.choice(eight))
if answer == 9:
        print(random.choice(nine))
if answer == 10:
        print(random.choice(ten))
if answer == 11:
        print(random.choice(eleven))
if answer == 12:
        print(random.choice(twelve))
if answer == 13:
        print(random.choice(thirteen))
if answer == 14:
        print(random.choice(fourteen))
if answer == 15:
        print(random.choice(fifteen))
if answer == 16:
        print(random.choice(sixteen))
if answer == 17:
        print(random.choice(seventeen))
if answer == 18:
        print(random.choice(eighteen))
if answer == 19:
        print(random.choice(nineteen))
if answer == 20:
        print(random.choice(twenty))
if answer == 21:
        print(random.choice(twenty_one))
if answer == 22:
        print(random.choice(twenty_two))
if answer == 23:
        print(random.choice(twenty_three))
if answer == 24:
        print(random.choice(twenty_four))
if answer == 25:
        print(random.choice(twenty_five))

guess = input("What do you think the answer is ? ")

if str(guess) == str(answer):
        print("well done!")
else:
        print("wrong!")
Reply


Messages In This Thread
my first attempt, please advise me of any thing - by danak - Jan-24-2020, 07:01 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020