aharr1cd

By aharr1cd

First Phython program

I've returned the Raspberry pie to Zibi, but had a day out of the sun installing the latest version of Geany into Ubuntu on my Netbook, so I could write my first program in Phython a game of pontoon (see below) it may not be rocket science, but it stopped me from getting sunburn.

#!/usr/bin/env python
import random
import string

def nextcard():
def id_generator(size=1, chars=string.digits):
return ''.join(random.choice(chars) for x in range(size))
card = id_generator()
if int(card) < 1:
card =11
print card
return card

def name():
first = ""
return first

count = 0
total = 0

name = raw_input("Enter your first name : ")

print "Hello " + name + " your first card is ..."

card=nextcard()

for i in range(1,8):
total=total+int(card)
print "Total so far is "
print total
if total > 21:
print "Lost " + name
break
elif total > 12:
print "Stay " + name
break
else:
print "Twist " + name + " your next card is"
card=nextcard()

Comments
Sign in or get an account to comment.