I'm having what will definitely be a very simple issue but I can't get my head around it.
I'm trying to get the user to input a desired website name, then use that to decide on the full name use that in another function. Here's the basics of the function.
def website():
x = input("Enter url:")
global url
if 'Google' in x:
url = ("www.google.com")
else:
"Try again!"
website()
This only works if I have global url there. Otherwise, it breaks. In the main function it tries to use the output url from website() straight away, but returns:
NameError: name 'url' is not defined
If global url isn't there. The next function literally prints the result of the previous function. It will do more but as I can't even get it to print yet I haven't got to that stage.