#πŸ”’ Guys i got a simple project it works fine but i need a professional review can you help me

22 messages Β· Page 1 of 1 (latest)

cinder remnantBOT
#

@light ivy

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

timber flame
#

@light ivy where is it?

light ivy
#

I can send it in dms

timber flame
#

you have to post it here.

light ivy
#

Δ°ts too large for here

timber flame
#

!paste

cinder remnantBOT
#
Pasting large amounts of code

So that everyone can easily read your code, you can paste it in this website:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

light ivy
#

Im on mobile rn

#

Ima send half

timber flame
#

maybe you can come back when you're at your desktop or laptop.

light ivy
#

guessing_game.py

import random
import time

secret_number = None
guess = 0
guess_counter = None
hints_left = None

while True:
secret_number = random.randint(1, 100)
start_time = time.time()
hints_left = 3
guess_counter = 0

def first_hint():
    if secret_number > 50:
        print("The secret number is greater than 50")
    else:
        print("The secret number is smaller than 50")

def second_hint():
    if secret_number % 2 == 1:
        print("The secret number is odd. ")
    elif secret_number % 2 == 0:
        print("The secret number is even. ")

def third_hint():
    if secret_number % 3 == 0:
        print("The number is divisible by 3. ")
    else:
        print("The number is not divisible by 3. ")

while guess != secret_number:
    try:
        guess = int(input("Guess a number 1-100 (type 0 for a hint): "))

        if guess == 0:
            if hints_left == 3:
                first_hint()
            elif hints_left == 2:
                second_hint()
            elif hints_left == 1:
                third_hint()
            elif hints_left == 0:
                print("No more hints! ")
            hints_left = hints_left - 1
            print(f"Hints remaining: {hints_left}")
            continue
#

guess_counter = guess_counter + 1

        if guess == secret_number:
            end_time = time.time()
            total_time = int(end_time - start_time)

            print("Correct! You win!")
            if guess_counter == 1:
                print("You are so lucky, you got it first try! ")
            else:
                print(f"you guessed the right number in {guess_counter} times")
            print(f"Time: {total_time} seconds!")
        elif guess < secret_number:
            print("Too low!")
        else:
            print("Too high!")
    except ValueError:
        print("Please enter a valid answer")

want_to_play = input("Do you want to play again? (y/n): ")
if not want_to_play.lower() == "y":
    break

print("Thank you for playing")

light ivy
timber flame
lavish epoch
#

!code

cinder remnantBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

light ivy
#

When those functions were out of the loop they only did the secret number out of the loop and i dont want that cus i got if you want to play again y or n

timber flame
light ivy
#

Anyways i hust asked ai and it totally agreed with you and explained why so tysm

cinder remnantBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.