[Tutor] Dividing a float derived from a string

2014-11-20 Thread Stephanie Morrow
Hi there, I have been posed with the following challenge: Create a script that will ask for a number. Check if their input is a legitimate number. If it is, multiply it by 12 and print out the result. I was able to do this with the following code: input = raw_input(Insert a number: ) if

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Danny Yoo
I have been posed with the following challenge: Create a script that will ask for a number. Check if their input is a legitimate number. If it is, multiply it by 12 and print out the result. I was able to do this with the following code: input = raw_input(Insert a number: ) if

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Danny Yoo
On Thu, Nov 20, 2014 at 3:05 PM, Stephanie Morrow svmor...@gmail.com wrote: What else could I do in that testing portion that would allow for a decimal point? In order for a decimal to be True, it would have to accept both the digits and the decimal point. Let's tackle a problem that's

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Stephanie Morrow
What else could I do in that testing portion that would allow for a decimal point? In order for a decimal to be True, it would have to accept both the digits and the decimal point. On Thu, Nov 20, 2014 at 10:36 PM, Danny Yoo d...@hashcollision.org wrote: I have been posed with the following

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Alan Gauld
On 20/11/14 21:20, Stephanie Morrow wrote: input = raw_input(Insert a number: ) if input.isdigit(): print int(input) * 12 else: print False /However/, a colleague of mine pointed out that a decimal will return as False. As such, we have tried numerous methods to allow it to divide

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Adam Jensen
#!/usr/bin/env python3.4 good = False s = input('Enter a number: ') a = s.split('.') n = len(a) if n = 2: for y in a: if y.isdigit(): good = True else: good = False exit else: good = False if good: num = float(s) print(num * 12)

Re: [Tutor] Data chart

2014-11-20 Thread Adam Jensen
import fileinput def parseLine(a): x = a.split('/') b = x[1].split(':') c = b[0].split('.') y = c[0] z = int(b[2]) return x[0], y, z print('{:4}{:10}{:8}{:8}'.format('','canofica','lnvd','msd')) data = [0, 0, 0] prevDate = None for line in fileinput.input():

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Adam Jensen
On Thu, 20 Nov 2014 21:20:27 + Stephanie Morrow svmor...@gmail.com wrote: Hi there, I have been posed with the following challenge: Create a script that will ask for a number. Check if their input is a legitimate number. If it is, multiply it by 12 and print out the result. I was

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Steven D'Aprano
My response is interleaved with yours, below. On Thu, Nov 20, 2014 at 09:20:27PM +, Stephanie Morrow wrote: Hi there, I have been posed with the following challenge: Create a script that will ask for a number. Check if their input is a legitimate number. If it is, multiply it by 12

[Tutor] break and exit

2014-11-20 Thread James Rieve
I accidently used 'exit' in a loop where I meant to use 'break' and, in that case, the program seemed to work as expected but in some cases 'exit' seems to behave differently from 'break'. For example, in this code snippet using 'exit' or 'break' produces the same result: for i in range(10):

[Tutor] Empty GraphicsWindow

2014-11-20 Thread niyanaxx95
I need help figuring why my GraphicsWindow empty, I cannot figure out why it is empty. Here is my code : # Import graphics from module from graphics import GraphicsWindow tileSize = 0 def main() : # Define global variables tilesInRow = 0 tilesInCol = 0 gapX = 0