Hello. mylist = [6, '/', 3, '+', 9, '+', 8, '+', 1, '/', 2] How can i delete that list indexes? I tried: def clear(self, event): global numbers for i in numbers: print i del numbers[i] But it didn't work: File "./kivycal", line 83, in clear del numbers[i] TypeError: list indices must be integers, not str What can i do for that?

Member Avatar
Member Avatar
+0 forum 5

Hey guys, Was wondering if someone could assist me in elaborating the c_str() function... I understand that it returns a pointer to an array that contains a null-terminated sequence of character but could someone further elaborate upon this, perhaps with a simple example. Cheers,

Member Avatar
Member Avatar
+0 forum 1

my [previous question](http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/477450/convert-str-to-var) about this dealt with global vars but unfortunatley the `window` of opportunitys doesn't work with this next example because it alerts 4 times instead of only 1 test("a","b","c"); function test(var0,var1,var2,var3) { for(var i=0; i<4; i++) { if(window["var"+i]===undefined) {alert("test");} } } this may not be very clear so I will try again this time I want it to alert all three vars test("a","b","c"); function test(var0,var1,var2) { for(var i=0; i<3; i++) { alert(window["var"+i]); } } how can I achieve the identical results as with the `window["str"+var]` from within a function?

Member Avatar
Member Avatar
+0 forum 1

this is my attempt var test=["a","b","c"]; var var0="a"; for(var i=0; i<1; i++) { test.splice(test.indexOf(test[window["var"+i.toString()]]),1); } alert(test); it alerts "a,b" but I want it to alert "b,c" ref:http://stackoverflow.com/questions/5613834/convert-string-to-variable-name-in-javascript

Member Avatar
Member Avatar
+0 forum 2

def main(): print ('Welcome to the mpg calculator program') print() #get the miles driven using the input function miles_driven = input ("Please enter miles driven: ") miles_driven = float (miles_driven) #get the gallons used using the input function gallons_used = input ("Please enter gallons used: ") galons_used = float (gallons_used) #calculate mpg here, using the inputted values mpg = miles_driven / gallons_used print('The MPG based on', format(miles_driven, '.2f'),\ 'miles driven and with', format(gallons_used, '.2f'), \ 'gallons used is:', format(MPG, '.2f'),sep=' ') #calls main main() >>> Welcome to the mpg calculator program Please enter miles driven: 200 Please enter gallons used: …

Member Avatar
Member Avatar
+0 forum 7

how to copy pointer to pointer. char *name1; //store the value of DAVE char *name2; if name2 was a array i would have done. strcpy(name2,name1); but i dont know how to copy pointer into pointer. i was thinking some thing like this. name2 = name1? also do i need to test malloc for name2?

Member Avatar
Member Avatar
+0 forum 2

*i am trying to copy the value of ar2[10] //in main. has the value 1,2,3,4,5 in ar[10] //(in struct node). empty array so to copy the value iam not sure if i could use a strcpy for ex, strcpy(head->ar, ar2); //here is my code struct node { int ar[10]; //empty array struct node *next; }; struct node *head; void insert_list1(int[]); int main() { int ar2[10]; //let just say ar2 has the value 1,2,3,4,5 insert_list1(ar2); } void insert_list1(int ar2[]) { struct node *cur_node = head; struct node *new_node; if(cur_node == NULL) { head = (struct node *) malloc(sizeof(struct node)); if(head == …

Member Avatar
Member Avatar
+0 forum 8

Hello I have a sequence that looks like this: 60211401dc070000 which is a string (it was build through a series of concatenations and conversions) How can i just tell him that it is actually a hex ?? without modifying it's value... Thanks! Have a nice day

Member Avatar
Member Avatar
+0 forum 5

how can i compare 2 string for bull hit game in python. i wrote the program itself. how can i find how many hits and bulls i have. [CODE]import string import random import re m = input (' Please input the long of the string you want to guess :') m= int(m) a = string.ascii_lowercase b = ''.join(random.choice(a) for x in range(m)) print(b) print ('now you can start guessing') z = input ('input your guess :') while b != z: if len(b) != len(z): print(' please enter a guess with the same lenght') print(' *reminder: its a',m,'letters long') z = …

Member Avatar
+0 forum 0

Hi all ; [ICODE]ask=raw_input("type the query: ") [/ICODE] when i type [ICODE]23+9[/ICODE] after this; i wanna get '32' result.. like ; [ICODE]>>>type the query: 3+5 >>>result : 8[/ICODE] this is what i want.. thank you..

Member Avatar
Member Avatar
+0 forum 1

input [CODE=python]import math print(repr(math.pi)) print(str(math.pi)) [/CODE] output [CODE=python]3.141592653589793 3.141592653589793[/CODE] could someone please tell me what the difference between [CODE=python]repr[/CODE] and [CODE=python]str[/CODE] is as the example on the documentation does not help as they both return the same figure? surely it does something more complex?

Member Avatar
Member Avatar
+0 forum 2

The End.