- Strength to Increase Rep
- +4
- Strength to Decrease Rep
- -1
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 5
- Posts with Downvotes
- 3
- Downvoting Members
- 5
study, understand and forget... this is in while(1) loop...
- Interests
- photography, reading books, writing articles
- PC Specs
- C, C++, python, SQL, HTML, XML, data structures
Re: I listen to music whenever I can, be it browsing, coding or anything else... soothes me down!! Currently listening: In the shadows by resmus | |
Re: If you understand list comprehensions, then this might be of some help: >>> def numberedSquare(n): for j in range(n,0,-1): print (''.join([str(i) for i in range(j,j+n)])) >>> numberedSquare(9) 91011121314151617 8910111213141516 789101112131415 67891011121314 5678910111213 456789101112 34567891011 2345678910 123456789 >>> numberedSquare(5) 56789 45678 34567 23456 12345 | |
Re: you can check the limits for your system in limits.h To get through your confusions, try to put those limits in binary form and you will yourself find that they are not clashing.. | |
Re: you might wanna skip things like: [CODE]letters = str(encrypted) ## you have taken encrypted as input from raw_input. So it would be a string anyways.[/CODE] And you can change lowercase to a set rather than a list. Checking for characters in it would become faster. | |
I was trying to find a solution for checking the symmetry of a tree. I would like to get some comments on the approach.. I am trying to do it by modifying the inorder traversal thing.. The pseudo code is: [CODE] // since the structure should be similar string in1,in2; … | |
Re: [QUOTE]def print_lol(movies): for each in movies: if isinstance(each,list): print_lol(each) else: print(each)[/QUOTE] [CODE]>>> def print_lol(movies): for each in movies: if isinstance(each,list): print_lol(each) else: print(each) [/CODE] This worked for me. I wanted to ask that if movies is not a list here ( you are checking via isinstance ), then what are … | |
I was looking around the time module. The time.sleep(no_of_seconds) sleeps the program for no_of_seconds seconds. I don't think this is busy wait. It must be scheduling the process at a later time. Just curious of how this is working.! :) | |
Re: Yes, you can use a call to getch() or getche() and check for the ASCII values. | |
Even after looking at a lot of books, I am not able to understand the problem in the following code: [CODE] //1.c static int y=23; void abc(int a){ printf("%d\n",a); } [/CODE] [CODE] //2.c #include<stdio.h> #include "1.c" int main(){ abc(12); printf("\n"); printf("%d\n",y); return 0; } [/CODE] I can understand that the … | |
I was looking at a question: Q. Given n numbers of which all numbers are repeated (at least once) other than one. We have to find that number. Numbers range is to 10^9, thus using count sort would do no good.! Adding the numbers one by one to a dictionary … | |
I just wanted to learn to create facebook applications using python.I am new to web development of any sorts, so everything seems to be weird right now. Here is what i acquired by google searching pages: This is the facebook developers page: [url]http://developers.facebook.com/opensource/[/url] Only one link to python.. [url]https://github.com/facebook/python-sdk[/url] The … | |
Re: [QUOTE] while (b=false)[/QUOTE] You are using the assignment operator here. This would assign the value false to b and continue in the loop. Rather try an use: [CODE] while(b==false){ //code to be used }[/CODE] Rather use this code: [CODE]bool b; cin>>birth; //remember to put in ';' b=isdigit(birth); while (b!=false) { … | |
I was trying to code the assembly line sheduling problem using the dynamic programming approach. I have coded the program but i am facing problem with the 2-dimensional arrays I am using. For testing purpose, I wanted to initialize the array, but I was not able to get it. Moreover, … | |
Re: The best way would be to calculate it during the process of input. [CODE] float s=0,l=0,x; for(int i=0;i<20;++i){ cin>>x; if(x>l) l=x; if(x<s) s=x; } /* Use the values */[/CODE] Or after taking the input in an array, go through it and get the smallest and largest values. [CODE] float s=0,l=0,a[20]; … | |
Re: maybe you are getting confused with your very own variables... Take it like this: you firstly initialize the variables with.: [CODE]int X=1, Y=2, Z=3, A=4, B=5, C=6, A1=7, A2=8, A3=9; [/CODE] Then you call a function F with arguments: (X, Y, Z, A, B, C) or (1,2,3,4,5,6) Fine.. Now the … | |
The last time I was making a program, I wanted to input from user a boolean answer (to save space ;)) An input of 0/1 works good (0-false) and (1-true), but if the user inputs the boolean values as "true" and "false", it comes out to be an error. So, … | |
Re: Check in the error. It usually gives the line number to look around for mistakes. If that does not work then you can post a better overview of your program.. | |
Re: Sorry, but can you please explain your program cause at my system it is not working for any of +,- or *. The program is not using the operator anywhere... | |
Re: Actually, the float type doesn't support modulus operator. That is why your program is giving an error. It is because the float numbers are stored in memory in two parts, mantissa and exponent. Now, if you understand the concept of pointers than try to understand this. When we call a … | |
Can someone please direct me to the code for the class <int> in python. I know that it must have written in C, but I could not understand, where to ask this query. Though I tried to figure it out myself, but could not even understand, which folder to attack … | |
Re: This seems to be your homework,.. Help yourself, use the karnaugh maps,.. it would be really easy.. If you want to know about K-maps, check at: [URL="http://en.wikipedia.org/wiki/Karnaugh_map"]Wikipedia[/URL] | |
Re: For the course: You can read: The schaum series, (I myself read it) Data structures with C, yashwant kanetkar or Data structures, Rajni Jindal. I too am a student at Delhi College of Engineering, and I assure it that these books would be enough for anything asked in exams. And … | |
Re: If this was an interview question, you could have assumed the array to be sorted. (I did assume many things in my interviews and cleared most of the rounds). Now, if the array is sorted, use a for loop with a search algorithm (binary search). The worst case would come … | |
Re: Use either a pickled dictionary as said by Beat_Slayer or if you want portability, use json module of python. (JavaScript Object Notation) | |
This may be quite a late introduction, but better late then never. I am having great fun at this forum. See me at C, C++ and python forums... got to learn a lot.. | |
Re: I believe, you don't need a forum, but some books to study from... Hope the following links help: [URL="http://www.daniweb.com/forums/thread20774.html"]thread1[/URL] [URL="http://wiki.python.org/moin/PythonBooks"]python books[/URL] | |
I have just started writing C code in dev-c++. The programs are running fine, but each C program shows me the following warning: [QUOTE] [Warning] command line option "-fno-access-control" is valid for C++/ObjC++ but not for C[/QUOTE] The test program I used was: [CODE] #include<stdio.h> int main(){ system("pause"); return 0; … | |
I was having some confusions about string and NULLs. So, I read this [URL="http://www.daniweb.com/forums/thread77987.html"]thread[/URL] on this very forum. But, I could not understand somethings... Firstly, Is NULL an integer value 0, or something else? Secondly, [CODE]if(strlen(str)==0)[/CODE] this shows that the string is null or it shows that the first character … | |
I want to sort a list of dictionaries using the inbuilt sort() function for lists. The problem is I am not able to understand, how to give the function a key.. Example: [CODE] a={'name':1,'data':200} b={'name':2,'data':400} c=[a,b] [/CODE] Now, I want to sort the list c with the key being a['name']. … | |
I want to print a float number with it's digits extending to 20000 digits after the decimal i.e. if the number is 10/3, it should print 3.333333333333333333333333333...20000 or more times. So, how do I print something like that? Also, do tell the solution for C and C++ as well... The … |