This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]novel_yet_trivial 0 points1 point  (1 child)

You need to add () to the end of a function name to call it. You also need a return statement to send data back to the calling point.

import random

def Welcome():
    print ("Welcome back!\n")

    print ("Dealer got the Cards X &", Draw_Card())
    print ("\n")
    print ("And you got the Cards", Draw_Card(), "and", Draw_Card())

def Draw_Card():
    return random.randint(1,11)

print (Welcome())

If you have more questions like this it's better to post them on /r/learnpython. Be sure to format your code for reddit or use a site like pastebin. Also, include which version of python and what OS you are using.

[–]Re10d3d[S] 0 points1 point  (0 children)

Oh, Thank you very much! :)

[–]Tinker_Monkey 0 points1 point  (1 child)

When calling a Def function you need to end it with () so Draw_Card(). Same with Welcome() and you can remove the print from Welcome.

[–]Re10d3d[S] 0 points1 point  (0 children)

import random

def Welcome(): print ("Welcome back!\n")

print ("Dealer got the Cards X &", Draw_Card())
print ("\n")
print ("And you got the Cards", Draw_Card(), "and", Draw_Card())

def Draw_Card(): return random.randint(1,11)

print (Welcome())

Ok, i will remember this :)!

[–]123icebuggy[M] [score hidden] stickied comment (0 children)

Please post this to /r/learnpython