In: Computer Science
Write a function called draw_card. It takes no arguments and returns an integer representing the value of a blackjack card drawn from a deck. Get a random integer in the range 1 to 13, inclusive. If the integer is a 1, print "Ace is drawn" and return 1. If the integer is between 2 and 10, call it x, print "<x> is drawn" and return x (print the number, not the string literal "<x>"). If the number is 11, 12, or 13, print "Jack", "Queen", or "King", respectively, "is drawn" and return 20.
import random
#draw_card function
def draw_card():
#selects an integer from 1 to 13 in num
num = random.randint(1,13)
#for int is 1
if num == 1:
print("Ace is drawn")
return
#for int is between 2 to 10
elif num>= 2 or num <= 10:
x = num
print(str(x) + " is drawn")
return x
#for Jack
elif num == 11:
print("Jack is drawn")
return 20
#for Queen
elif num == 12:
print("Queen is drawn")
return 20
#for King
elif num == 13:
print("King is drawn")
return 20
#function call of draw_card
num = draw_card()
Please refer below screenshot of code for indentation purpose and output
Output also shown in the same.