19 Discussion / Question Topics

Remove Filter
Member Avatar for D33wakar

If there's a list like below [CODE]s=['b','a','r','r','i','s','t','e','r'][/CODE] and if I tried to remove every 'r' from the list like this [CODE]>>> for x in s: if(x=='r'): s.remove(x)[/CODE] it gives the following result. [CODE]>>> s ['b', 'a', 'i', 's', 't', 'e', 'r'][/CODE] Why isn't the last 'r' removed from the list.

Member Avatar for D33wakar
0
104
Member Avatar for D33wakar

I wrote a procedure to read integers(unsigned) from stdin and store it in a variable. I wanted it to handle backspaces too. so I made some adjustments but unfortunately it didn't work.--see line 14 in the code [CODE]get_num: ;(function get_num: read integers from stdin) push ax ;save all registers push …

Member Avatar for D33wakar
0
1K
Member Avatar for D33wakar

Alright, here's the deal.There's a folder with Jpg images and I want to open each JPG image in that folder, rotate it clockwise once and save it with the same name in the same folder. How do I do that with batch programming? We Can't use "Windows Picture and Fax …

Member Avatar for D33wakar
0
133
Member Avatar for D33wakar

[CODE] .MODEL small .STACK 100h ; defines a stack 100h (256) bytes long .DATA String DB "Hello World!",'$' ; variable declaration .CODE Start: mov dx,offset String ; point dx to the storage location for the first character mov ah,9 ; dos function for string output int 21h Stop: mov ax,4C00h …

Member Avatar for D33wakar
0
249
Member Avatar for D33wakar

I'm Using [ICODE]fwrite[/ICODE] to print the contents of a sturcture in a file. [CODE] #include <stdio.h> #include <stdlib.h> struct com{ int code; char* name; }; int main() { struct com py[2]={{21,"Monty Python"}, {22,"Python lang"} }; FILE * fp; if((fp=fopen("data.txt","w+"))==NULL) exit(1); fwrite(&py,sizeof(struct com),1,fp); /*int i; for(i=0;i<2;i++) fprintf(fp,"code:%d,name:%s\n",py[i].code,py[i].name); */ fclose(fp); return 0; …

Member Avatar for Narue
0
113
Member Avatar for D33wakar

I am trying to write a program for searching strings(one at a time)in a text file. To start things off, I wrote this one. [CODE] #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main() { FILE *txt_file; int chr;/*char read by fgetc*/ int word_match=0; const char* substring ="window";/*search word*/ …

Member Avatar for Narue
0
231
Member Avatar for D33wakar

Here's a code to find out if the number is palindrome or not. [CODE] #include <stdio.h> int main() { int num,chknum1,chknum2=0,i,rmndr;/*here rmndr is remainder after mod,chknum is reversed num*/ printf("enter the number"); scanf("%d",&num); chknum1=num;/*saving num,since it is manipulated*/ for(i=0;i<=sizeof(chknum1);i++) { rmndr=num%10; num=num/10; chknum2=chknum2*10+rmndr; } printf("chknum1 %d,chknum2 %d",chknum1,chknum2); //if(chknum1=chknum2) //printf("Is palindrome"); …

Member Avatar for TrustyTony
0
453
Member Avatar for D33wakar

[CODE] #include <stdio.h> float pows(float,float); int main() { float num,base; printf("enter base followed by power integer."); scanf("%f %f",&base,&num); printf("%f ",pows(base,num)); return 0; } float pows(float base,float n) { if(n==0) return(1); else if(base==0) return(0); else for(;n>=1;n--) { return(base*pows(base,n-1));/*recursive*/ } } [/CODE]

Member Avatar for D33wakar
0
151
Member Avatar for D33wakar

I'm trying to embed python script in c in windows. [CODE] #include <Python.h> int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time())\n"); Py_Finalize(); return 0; } [/CODE] from the python documentation. I'm compiling with Microsoft's lcc. I'm getting following errors. Error c:\lcc\examples\python\pyembed.c 7 undefined reference …

Member Avatar for D33wakar
0
397
Member Avatar for D33wakar

I'm trying to convert hexadecimal values to Binary. I've done Decimal values to Binary up to 32 bits in this way: [CODE] #include <stdio.h> int showbits(int);/**************function*prototype******************************/ int main() { unsigned int num; printf("enter the number."); scanf("%d",&num); printf("%d in binary is ",num); printf("\n"); showbits(num);/*********************function*call********************************/ return 0; } showbits (int n)/******************function*definition****************************/ //* …

Member Avatar for D33wakar
0
407
Member Avatar for D33wakar

I've been trying to automate the creation of a user account with admin rights using cmd bat . [CODE] net localgroup administrators [I]account name[/I]/add [/CODE] got the following error: [CODE]There is no such global user or group:[I]account name[/I][/CODE] what's the problem?

Member Avatar for VulcanDesign
0
141
Member Avatar for D33wakar
Member Avatar for Ancient Dragon
0
68
Member Avatar for D33wakar

I want to run a program every time windows starts with a certain user's credentials . If i did that in bat file ,it will prompt for the user's password.How can i automate the insertion of password?

Member Avatar for rch1231
0
98
Member Avatar for D33wakar

make failed Error: Error: Unresolved external '_main' referenced from C:\BC5\LIB\C0X32.OBJ I got above error when trying to build one of the examples given in \BC5\examples directory.What is the cause?

Member Avatar for D33wakar
0
235
Member Avatar for D33wakar

using wx python.got black bars instead of unicode characters in gui window. [hint]:My interpreter gives error- [COLOR="Red"]Unsupported characters in input[/COLOR]

0
79
Member Avatar for D33wakar

[CODE]def nod(n): c,i=0,0 while n>0: c=n%10 if c!=0: i=i+1 n=n//10 print(i)#prints the number of digits in the given integer 'n' [/CODE] how to make it able to count 'zeros'?

Member Avatar for Beat_Slayer
0
144
Member Avatar for D33wakar

I used py2exe to make an executable,works fine.But even for a simple app I've got 18 other files(.pyd and dlls includinf pythonxy.dll) in the dist folder. I've heard that these files can be compressed into the executable using Gui2exe. I have Gui2exe installed already but haven't quite used it due …

0
92
Member Avatar for D33wakar

I was using winsound module for the first time to use it on one of my small app,and it didn't even gave me a BEEP!. I imported winsound module first. [CODE] >>> import winsound >>> [/CODE] then [CODE]winsound.Beep(37,10)[/CODE]leads to nothing! Any kinda help is appreciated.

Member Avatar for vegaseat
0
9K
Member Avatar for D33wakar
Member Avatar for gerard4143
0
110

The End.