我已经将用户输入的DNA代码(A,T,G,C)转换为RNA代码(A,U,G,C).这很容易
RNA_Code=DNA_Code.replace('T','U')
Run Code Online (Sandbox Code Playgroud)
现在我需要做的下一件事就是将RNA_Code转换成它的赞美链.这意味着我需要用U代替A,用A代替A,用C代替G,用G代替C.
如果我说
RNA_Code.replace('A','U')
RNA_Code.replace('U','A')
Run Code Online (Sandbox Code Playgroud)
它将所有的As转换为我们,然后将所有的Us转换为As,但我留下了所有的As.
我需要它来采取类似的东西AUUUGCGGCAAA并将其转换为UAAACGCCGUUU.
关于如何完成任务的任何想法?(3.3)
我有一个问题.我需要得到像一年中的一天,一个月中的某一天,一年中的一些等等.我使用此代码:
#include <stdio.h>
#include <time.h>
int main(void)
{
time_t liczba_sekund;
struct tm strukt;
time(&liczba_sekund);
localtime_r(&liczba_sekund, &strukt);
printf("today is %d day of year\nmonth is %d, month's day %d\n", strukt.tm_yday+1, strukt.tm_mon+1, strukt.tm_mday);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
第一件事:为什么gcc -std = c99 -pedantic -Wall会返回此警告:
我的输入:gcc test_data.c -o test_data.out -std = c99 -pedantic -Wall
输出:
test_data.c:在函数'main'中:
test_data.c:11:3:警告:函数'localtime_r'的隐式声明[-Wimplicit-function-declaration]
第二件事:如何让它在Windows上运行?在尝试使用Dev-C编译它时,我得到了这个:http: //imgur.com/U7dyE
@@ EDIT --------------------我找到了一个当地时间建议的例子:
#include <stdio.h>
#include <time.h>
int main ()
{
time_t time_raw_format;
struct tm * ptr_time;
time ( &time_raw_format );
ptr_time = localtime ( …Run Code Online (Sandbox Code Playgroud) 在Python-3中运行此脚本时:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import random
import os
import threading
import sys
class bot(threading.Thread):
def __init__( self, net, port, user, nick, start_chan ):
self.id= random.randint(0,1000)
self.irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
self.irc_connect ( net, port )
self.irc_set_user( user,nick )
self.irc_join( start_chan )
self.finnish=False
threading.Thread.__init__(self)
def run( self ):
while not self.finnish:
serv_data_rec = self.irc.recv ( 4096 )
if serv_data_rec.find ( "PING" ) != -1:
self.irc.send( "PONG"+ serv_data_rec.split() [ 1 ] + "\r\n" )
elif …Run Code Online (Sandbox Code Playgroud)