24 Topics
| |
Dear All, I have a very long list of values as follow (43, 560) (516, 1533) (1316, 3047) (520, 1528) (3563, 1316) (45, 557) (3562, 1312) (2686, 1964) (2424, 3340) (3559, 1317) (50, 561) (2427, 3336) (1313, 3046) (3562, 1313) (3559, 1318) (2689, 1962) (2429, 3339) (3721, 2585) (1317, 3048) … | |
The Swift computer language is the brainchild of a number of Apple associates. In my humble opinion it shows some nice features, but also some warts. Part 1 (constants, variables, strings, tuples, arrays) explores a number of the features to give you a taste of the language. I hope I … | |
Hi guys, I have written a program which currently accumalates different pairs and their frequency from an excel spreadsheet. (1280 pairs) Want I want to achieve is from the top 20/30 pairs, if I can find pairs that link e.g. Pair 1 [1,33] and Pair 100 [1,232] so i would … | |
How to use two models in a view using Tuple and view model and what is there diffences? | |
This is my code: class MyTime: def __init__(self, hrs=0, mins=0, secs=0): self.hours = hrs self.minutes = mins self.seconds = secs if self.seconds >= 60: self.minutes += self.seconds // 60 self.seconds = self.seconds % 60 if self.minutes >= 60: self.hours += self.minutes // 60 self.minutes = self.minutes % 60 if self.hours … | |
Don’t know if this is ever been done before, or even if it is a good way to do it. I’ll just await your comments if any. What I mostly found on the web is that if you want to define a polynomial you need to have an array containing … | |
Hello everyone! I would like your help regarding this: I have a tuple vector which i must iterate through, and accessing the vector data to decide wether to erase or not the current vector element. My code : typedef tuple <int, CString, int, int> pc_data; vector <pc_data> pc_vec; //Assume that … | |
I have a data set like this data=[{u'a': u'D', u'b': 100.0, u'c': 201L, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 1, 1, 6, 27, 41)},{u'a': u'W', u'b': 100.0, u'c': 201L, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 2, 4, 6, 27, 41)},{u'a': u'W', u'b': 100.0, u'c': 202L, u'd': … | |
I wrote out a test for a Complex class on python but I'm getting an error. Here's what I have: class Complex: def __init__(self, real=0, imaginary=0): self._r=real self._i=imaginary def __add__ (self, other): return Complex((self._r + other._r), (self._i + other._i)) def __sub__ (self, other): return Complex((self._r - other._r), (self._i - other._i)) … | |
Dear Friends, I have a sequence of two values as the following: 00001.doc d:\pathtofile\image50.jpg 00002.doc d:\pathtofile\image38.jpg 00003.doc d:\pathtofile\image40.jpg ... I would like to add the values to a list, sort the list by second value and rename the first value accordingly. For example, the following steps: Step 1 '00002.doc', 'd:\pathtofile\image38.jpg' … | |
Dear friends, sorry for my ignorance about python containers but I have the need to store (and access) 4 different values per file in folder, namely the filename (with its path) and 3 other values (string or None). When I access the database, I will need to know the 3 … | |
hi guys. our teacher posted a bonus a while ago that has me scratching my head. he still will not show us how to do it. i was wondering if u guys could crack it. here are the instructions: [Click Here](http://prntscr.com/inqqz) there are also **2 ** files to supplement: **.txt** … | |
so im trying to make it so that pressing enter without inputting any value, will break the loop, however, an empty string can be used because of [ICODE]for i in range(len(x_str_array)): x[i] = int(x_str_array[i]) bit.[/ICODE] [CODE] 'Exercise 7.3' # modified program from exercise 7.2 a=1 z="" while x !=z: x_str … | |
Hey, I have a set of types which are all arithmetic (have operators for addition, subtraction, multiplication, etc.). I want to aggregate any number of them into a single object, so I'm using the std::tuple class template and the <tuple> library (and Boost.Tuple for backward compatibility). My question is a … | |
Having problems with the TypeError below: [code]order_list = ['25459 ', '12381 ', '25375 '] cursor.execute("SELECT WVGID6 , WVWHID, WVITNO, WVLOCA FROM WMRSV WHERE OHORNO IN (%s)"% tuple(order_list)) TypeError: not all arguments converted during string formatting[/code] The correct SQL should look like: [CODE]SELECT WVGID6 , WVWHID, WVITNO, WVLOCA FROM WMRSV WHERE … | |
Although [url=http://en.wikipedia.org/wiki/Roman_numerals]roman numerals[/url] sneak in our lives from time to time, we(luckily) don't use them very often. Probably the reason why the Romans where not that good at calculating things. That changed, more than 1000 years later, with [url=http://en.wikipedia.org/wiki/Fibonacci]this person[/url] who introduced to the Western world the number system we … | |
Tuples are immutable objects, they cannot be changed says the Python manual. [code]my_tuple = (1, 2, 3, [4, 5, 6]) # this works my_tuple[3][2] = 7 # clearly the item at index 3 in the tuple has changed print(my_tuple) # (1, 2, 3, [4, 5, 7]) [/code] | |
I have a code designed to show the different spaces a knight can move to in a standard chess game. It needs to be a function created that outputs the possible spaces in tuples. I can't figure out how to make the output in tuples and I would appreciate it … | |
Starting with version 2.6 Python has introduced a new container called the named tuple. You can use it similar to a class based record structure, but it has the memory efficiency of a tuple. | |
Here is way to put easily editable layout for input fields with standard look and collect the text variables to list for use. | |
Here is some saved interaction in command prompt. [CODE]>>> type((1,2)) <type 'tuple'> >>> (3*x for x in (4,4)) <generator object <genexpr> at 0x00E73EB8> >>> tuple(x**2 for x in range(10)) (0, 1, 4, 9, 16, 25, 36, 49, 64, 81) >>> set(x for x in range(10)) set([0, 1, 2, 3, 4, … | |
I need to code a program that input will be any random string and the the output will include processes, unprocessed string. EX: Input String : XYZZXXYYXYZZXYZ Unique Prefixes : ['', 'X', 'Y', 'Z', 'ZX', 'XY', 'YX', 'YZ', 'ZXY'] Encode List : [(0, 'X'), (0, 'Y'), (0, 'Z'), (3, 'X'), … | |
I am relatively new to python, and have run into an issue with reading a strangely formatted output file. The current format of the output file for each line is [(x,y),.....(x,y)] (tuples nested within a list?) and I need to read each line in the file and output a 3 … | |
I am new-ish to python and need to write a short program which will take a file with many lines of sets of coordinates alongside a defined variable of a series of letters and out a 3 columned file with columns x, y, and letter. the input file has each … |
The End.