Flag control variable

2014-02-11 Thread luke . geelen
hello, i'd like to know how to set up a flag to change a variable, for example, i want a simple script to combine 2 numbers, sum = num + another_num print "Now the sum of the numbers equals : ", sum how could i make it so that if i type python ./script.py 21 41 that i get the sum of 21 and 41 ?

Re: Flag control variable

2014-02-11 Thread luke . geelen
Thanks a lot -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread luke . geelen
when expandig the script to multiple calcs i got a problem >>> a = 32 >>> c = 51 >>> sign = * File "", line 1 sign = * ^ SyntaxError: invalid syntax is there a way of adding * without quoting marks, because if you do it just soms the arguments -- https://mail.python.org/mailman/l

Re: Flag control variable

2014-02-11 Thread luke . geelen
well i'm trying something else but no luck : #!bin/bash/python import sys import os a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, "=", a + b command1 = "sudo mpg321 'http://translate.google.com/translate_tts?tl=en&q=%s_plus%s_

Re: Flag control variable

2014-02-11 Thread luke . geelen
Op dinsdag 11 februari 2014 19:55:59 UTC+1 schreef Gary Herron: > On 02/11/2014 10:37 AM, luke.gee...@gmail.com wrote: > > > well i'm trying something else but no luck : > > > > > > #!bin/bash/python > > > import sys > > > import os > > > a = int(sys.argv[1]) > > > sign = (sys.argv[2]) > >

Re: Flag control variable

2014-02-11 Thread luke . geelen
Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: > luke.gee...@gmail.com wrote: > > > > > well i'm trying something else but no luck : > > > > > > #!bin/bash/python > > > > Hm. > > > > > import sys > > > import os > > > > For debugging purposes put the line > > > >

Re: Flag control variable

2014-02-11 Thread luke . geelen
Op dinsdag 11 februari 2014 20:01:05 UTC+1 schreef luke@gmail.com: > Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: > > > luke.gee...@gmail.com wrote: > > > > > > > > > > > > > well i'm trying something else but no luck : > > > > > > > > > > > > > > #!bin/bash/py

Re: Flag control variable

2014-02-11 Thread luke . geelen
Op dinsdag 11 februari 2014 20:28:44 UTC+1 schreef Tim Chase: > On 2014-02-11 11:06, luke.gee...@gmail.com wrote: > > > > > > command1 = "sudo mpg321 > > > > > > > > > > > > > > > > > > > > > > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > > >

Re: Flag control variable

2014-02-11 Thread luke . geelen
hey, i got another problem now, if i use the imterpreter to do 3 * 4 it gives twelve the script gives ? any tips -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-11 Thread luke . geelen
Would it be possible to make an int(sys.argv[1]) Not needed and set value 0 ( or in another script 1) For example a = int(sys.argv[1]) b = int(sys.argv[2]) c = int(sys.argv[3]) And I run Python ./script.py 2 3 It just set c automaticly to 0 or 1 Luke (PS thanks for the quick help) -- https:

Re: Flag control variable

2014-02-11 Thread luke . geelen
Can I make it that if C = int(sys.argv[3]) But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-12 Thread luke . geelen
Op woensdag 12 februari 2014 06:23:14 UTC+1 schreef Dave Angel: > luke.gee...@gmail.com Wrote in message: > > > Can I make it that if > > > C = int(sys.argv[3]) > > > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > > > > > > > Why do you ask for 'automatically'?

Re: Flag control variable

2014-02-12 Thread luke . geelen
Op woensdag 12 februari 2014 17:10:36 UTC+1 schreef Alain Ketterlin: > luke.gee...@gmail.com writes: > > > > > Can I make it that if > > > C = int(sys.argv[3]) > > > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > > > > C = int(sys.argv[3]) if len(sys.argv) > 3 e

decimal numbers

2014-02-15 Thread luke . geelen
hello, i have been working on a python resistor calculator to let my class show what you can do with python. now i have a script that makes the more speekable value of the resistance (res) #if len(str(res)) > 9: # res2 = res / 10 # print "de weerstand is %s,%s giga ohms" % (res2) #elif

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > hello, > > i have been working on a python resistor calculator to let my class show what > you can do with python. > > now i have a script that makes the more speekable value of the resistance > (res) >

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: > "Luke Geelen" wrote in message > > news:ec88852e-1384-4aa5-834b-85135be94...@googlegroups.com... > > > Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > > > hello, &

Re: decimal numbers

2014-02-15 Thread Luke Geelen
If i do set form thing in my script i get Invalide syntax pointing at the last word of the form rule -- https://mail.python.org/mailman/listinfo/python-list

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > If i do set form thing in my script i get > > > Invalide syntax pointing at the last word of the form rule > > > > Please copy and paste the

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 18:42:51 UTC+1 schreef Luke Geelen: > Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > > > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > > > > > If i do set form thing in my script i get > > > >