104 Posted Topics

Member Avatar for aot

[quote=aot;328810]Here's something that I've wished for a number of times so far: the ability to create a function (taking X) that creates X variables, even if they are all initialized to the same value. For example, [inlinecode]f(3)[/inlinecode] would assign [inlinecode]var1 = 0[/inlinecode], [inlinecode]var2 = 0[/inlinecode], and [inlinecode]var3 = 0[/inlinecode]. My …

Member Avatar for aot
0
135
Member Avatar for AikoYamamato

[quote=AikoYamamato;329003]Basically I'm trying to take a Template String and store it in a variable for later use. I'm new with Python and programming languages in general so I'm finding difficulty in doing this. This is the code I'm using to generate the string: [code]from string import Template s = Template('$who …

Member Avatar for AikoYamamato
0
181
Member Avatar for aloishis89

[quote=aloishis89;328261]I am very new to python and am learning it just for fun. I am attempting to use it for a small application that shuffles a string list. I need to get a list of about 50 last names in a random order. I tried doing [code] items = [thing1, …

Member Avatar for aloishis89
0
162
Member Avatar for Lardmeister

[quote=Lardmeister;327345]I have for instance this function I wrote and want to assure that the argument is a number when I call the function. [code]def hypotenuse(n): "return the length of the hypotenuse of an isosceles triangle" return (n*n + n*n)**0.5 sides = 3.7 print hypotenuse(sides) [/code]Any ideas how to do this?[/quote] …

Member Avatar for jrcagle
0
645

The End.