This is the program I need to write:
At each step the user is asked if she wants another number. If she does, the program adds a random number between 1 and 10 onto her total. The game ends when she quits, or when her total is 18 or higher. If her total is between 18 and 21, she wins and you should print a message saying so. If she goes over 21 or quits before she gets to 18, tell her that she loses. Don't let the program end silently; in every case you should say if the user wins or loses. This is what it should look like
Your current total is 0.
Do you want another number? yes or no: yes
Your number is 2, making your total 2.
Do you want another number? yes or no: yes
Your number is 9, making your total 11.
Do you want another number? yes or no: yes
Your number is 10, making your total 21.
YOU WIN!!!
I pretty much only know "While, If, and For loops as well as break and continue statements.
I can only get to the first randint. After that I'm kind of lost.
#Simple blackjack game
#Aces are always equal to one
from random import *
def main():
print "Hello welcome to Blackjack"
print "Your final total must be between 18 and 21 to win"
total=[randint (1,10)]
print "Your first card is %d would you like another card (y/n)"%randint (1, 10),
card= raw_input()
if card=='y' or "Y":
print"You drew a %d. Would you like another card? (y/n)" %randint (1, 10),
print "Your total is " + str(sum(total))
main ()
Of course, this ends after the first two draws. The total is a randint (1,10). I guess I don't actually understand what str(sum(total)) does.