r/PythonLearning • • Oct 21 '25

Showcase rate my code

Post image

im learning python right now and need some feedback

170 Upvotes

41 comments sorted by

View all comments

2

u/Cursor_Gaming_463 Oct 21 '25 edited Oct 22 '25

It'd do it like this instead:

def open_random_website(domain: str = ".com") -> None:
   website = "https://" + requests.get("https://random-word-api.herokuapp.com/word").text.strip("[").strip("]").strip("\"") + domain
    webbrowser.open(website)

if __name__ == "__main__":
    open_random_website()  

edit: wtf you can't comment code?

edit2: nvm you can.

1

u/cgoldberg Oct 21 '25

Your code has syntax errors and also tries to open a url with no domain