您好,我这里有一段python程序,想把它改写为PHP程序,希望帮帮忙,非常感谢了 5
/Dr.Han’simplementationoftheBWT//20140408$t="tomorrow_and_tomorrow_and_tomorrow";$bwt...
/ Dr. Han’s implementation of the BWT
// 20140408
$t = "tomorrow_and_tomorrow_and_tomorrow";
$bwt_t = bwt($t);
$tBack = reverseBwt($bwt_t);
print "t: $t\n";
print "bwt_t: $bwt_t\n";
print "t_back: $tBack\n";
print "Job done!\n";
function bwt($t){
……
}
function reverseBwt($bw){
……
}
结果:
‐bash‐3.2$ php bwt.php
t: tomorrow_and_tomorrow_and_tomorrow
bwt_t:
wwwdd__nnoooaatttmmmrrrrrrooo__$ooo
t_back:
$worromot_dna_worromot_dna_worromot
Job done!
‐bash‐3.2$
如果没错的话,您应该是国科大的学长,这是韩春生老师的作业,很为难 展开
// 20140408
$t = "tomorrow_and_tomorrow_and_tomorrow";
$bwt_t = bwt($t);
$tBack = reverseBwt($bwt_t);
print "t: $t\n";
print "bwt_t: $bwt_t\n";
print "t_back: $tBack\n";
print "Job done!\n";
function bwt($t){
……
}
function reverseBwt($bw){
……
}
结果:
‐bash‐3.2$ php bwt.php
t: tomorrow_and_tomorrow_and_tomorrow
bwt_t:
wwwdd__nnoooaatttmmmrrrrrrooo__$ooo
t_back:
$worromot_dna_worromot_dna_worromot
Job done!
‐bash‐3.2$
如果没错的话,您应该是国科大的学长,这是韩春生老师的作业,很为难 展开
1个回答
展开全部
变量前面有$,语句结束必须有 ;
你给的明显是php程序吧?
改成python试试:
#Dr. Han’s implementation of the BWT
#20140408
def bwt(t):
.... #楼主,你省略了php语句,让我怎么改?是一段加密算法?
def reverseBwt(bw):
.... #楼主,你省略了php语句,让我怎么改?是一段解密算法?
t = "tomorrow_and_tomorrow_and_tomorrow"
bwt_t = bwt(t)
tBack = reverseBwt(bwt_t)
print "t: "+t+"\n"
print "bwt_t: "+ bwt_t +"\n"
print "t_back: "+tBack+"\n"
print "Job done!\n"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询