Re: [Tutor] Python 3: string to decimal conversion

2016-05-23 Thread US
;).replace(',','')) except decimal.InvalidOperation as e: print("unexpected expenses value: %r" % (row[4])) On Mon, May 23, 2016 at 5:06 AM, Peter Otten <__pete...@web.de> wrote: > US wrote: > >> Thank you

Re: [Tutor] Python 3: string to decimal conversion

2016-05-23 Thread US
gnore them. That's why I had the >> ValueError exception. > > > I have two observations here: > > Your strings in row[4] are not empty. If that output is repr(row[4]) then > row[4] contains the text: > > "" > > That is a two character string co

Re: [Tutor] Python 3: string to decimal conversion

2016-05-22 Thread US
Thank you all for the useful feedback. I am new to programming so bear with me while I learn the rules... I have run Cameron's code to print the values and have the traceback results. please see below. -Original Message- From: c...@zip.com.au [mailto:c...@zip.com.au] Sent: Saturday, Ma

Re: [Tutor] The game of nim in python

2016-04-22 Thread Henderson, Kevin (GE Aviation, US)
Python to Jython. Can you help me with a Jython code for the Nim game? Removing 1-4 sticks out of 13, last player who picks up the last stick wins Player 1 vs player2(Computer) player1=str(input("Enter your name. ")) player2="Computer" howMany=0 gameover=False strawsNumber=random.randint(10,20)

[Tutor] Flip a coin

2013-04-09 Thread Najam Us Saqib
Hi, This program is killing me, I have been working on it for last 3 hours, I have tried my best but can't make it work, please help me out.  The Problem: Create a program that flips a coin 100 times and than tells you the number of tails and heads. My code: # Flip a coin import random fli

[Tutor] While loop

2013-04-06 Thread Najam Us Saqib
Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Thank you. Najam. count = 0 while True:     count += 1     # end loop if count is greater than 10     if count > 10:         break # means "break out of the loop"     # skip 5     if c

[Tutor] basic question

2013-04-05 Thread Najam Us Saqib
Hi, My name is Najam, I am very new to Python Programming. Would you please help me with the following question? The question/problem is, Write a Car salesman program where the user enters the base price of a car. The program should add a bunch of extra fees such as tax, license, dealer prep,