Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
(Sep-20-2019, 11:17 AM)perfringo Wrote: If you look at this code you probably notice that in order to explain the solution I created unnecessary list of chunks. We actually don't need to create this... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-20-2019, 11:45 AM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
(Sep-20-2019, 08:47 AM)perfringo Wrote: It's unclear where III comes from.
But maybe this can help:
(1) Create datastructure to hold sequences:
amino_acids = {**dict.fromkeys(['ATT', 'ATC', 'ATA'... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-20-2019, 09:25 AM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
(Sep-20-2019, 08:05 AM)perfringo Wrote: (Sep-20-2019, 07:57 AM)YoungGrassHopper Wrote: I am struggling with getting the chunks joined in list form after they get divided in workable chunks of [['A... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-20-2019, 08:26 AM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
[attachment=714] (Sep-20-2019, 06:33 AM)perfringo Wrote: (Sep-19-2019, 01:56 PM)YoungGrassHopper Wrote: DD is not a full codon and needs to be removed from the sequence
This code will not work acc... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-20-2019, 07:57 AM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
I found a solution, I will set this thread to solved, thanks ichabod801 for your input
dna = AAABBBCCCDDD
x=3
chunks = [dna[y-x:y] for y in range(x, len(dna)+x,x)]
print(chunks) |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-19-2019, 05:21 PM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
But getting the tail cut off is the easy part , what I cannot seem to figure out is how to get the AAABBBCCC in workable chunks of 3 like:
dna1 = AAA
dna2 = BBB
if you don't know the length of the... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-19-2019, 04:03 PM |
|
|
Thread: List/String seperation issue
Post: RE: List/String seperation issue
(Sep-19-2019, 01:58 PM)ichabod801 Wrote: You are not accounting for the case wher e DNA % 3 == 2. In that case you need to delete two items. The modulus operator gives you how many items you need to... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-19-2019, 02:13 PM |
|
|
Thread: List/String seperation issue
Post: List/String seperation issue
Hey guys,
Hope you can shed some light on this matter.
In this task I need to create a function that displays the amino acid type that corresponds to a codon. for example if the user inputs a DNA seq... |
|
YoungGrassHopper |
General Coding Help |
13 |
5,470 |
Sep-19-2019, 01:56 PM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-16-2019, 06:09 AM)perfringo Wrote: (Sep-16-2019, 05:23 AM)YoungGrassHopper Wrote: Oh wow I did not know there is an alternative way to open files, and I was explicitly told to please remember... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-16-2019, 06:46 AM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-16-2019, 05:11 AM)perfringo Wrote: EDITED: initial code contained error. Blank lines contain newline at end, so line must be stripped otherwise it will be truthy (contains newline). Therefore r... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-16-2019, 05:23 AM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-16-2019, 12:47 AM)jefsummers Wrote: Is there a blank line at the end of the data?
Hi jefsummers, if I understand you correctly, no it seems like there wasn't. And I'm not sure if what I did is ... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-16-2019, 04:45 AM |
|
|
Thread: String handling
Post: RE: String handling
[attachment=711]
I feel terrible for not being able to create this code myself, super jealous of your skills haha but thanks Perfringo you saved me on this one big time. I got it running but I am get... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 10:37 PM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-15-2019, 05:38 PM)perfringo Wrote: There is always couple of minutes to spare and use them for thinking. Majority of assignments are solvable with 'pure' thinking. Some potentially useful tidbi... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 08:28 PM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-15-2019, 12:21 PM)jefsummers Wrote: This may nudge you in the right direction. Just doing it for one entry, but you know how to loop now to repeat this...
str = "Orville Wright 21 July 1988"
st... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 01:12 PM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-15-2019, 12:21 PM)jefsummers Wrote: This may nudge you in the right direction. Just doing it for one entry, but you know how to loop now to repeat this...
str = "Orville Wright 21 July 1988"
st... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 12:33 PM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-15-2019, 09:55 AM)snippsat Wrote: In a ordinary loop it would be like this.
>>> string = 'The quick brown fox jumps over the lazy dog. '
>>> characters = 'aeiou'
>>> ... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 12:01 PM |
|
|
Thread: String handling
Post: RE: String handling
Thanks @perfringo that settles my lack of understanding,
And thanks @ndc85430 for path to the info. I think this is solved now appreciate all the input. |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 08:12 AM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-14-2019, 10:41 AM)metulburr Wrote: its better to hard code and remove input() when posting on the forums such as
string = 'The quick brown fox jumps over the lazy dog. '
characters = 'aeiou'
st... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-15-2019, 07:02 AM |
|
|
Thread: String handling
Post: RE: String handling
(Sep-14-2019, 10:41 AM)metulburr Wrote: its better to hard code and remove input() when posting on the forums such as
string = 'The quick brown fox jumps over the lazy dog. '
characters = 'aeiou'
st... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-14-2019, 10:42 AM |
|
|
Thread: String handling
Post: String handling
Hey guys.
Here is what I have to accomplish:
● Ask the user to input a string and then ask the user which characters they would like to make disappear.
For example: The quick brown fox jumps over th... |
|
YoungGrassHopper |
General Coding Help |
23 |
8,867 |
Sep-14-2019, 10:30 AM |