Answer to Question #250140 in Python for lastone

Question #250140
import time
nucleotides="ATGC"
nulength= len(nucleotides)
nucleostring=""
noofbase=0
inputbase= int(input("Enter the number of base: "))
while noofbase < inputbase:
rand=int(time.time_ns())
randomno=rand%nulength
nucleostring+=nucleotides[randomno]
noofbase+=1
print(nucleostring)
print("Forward: ")
print("DNA Seq")
if len(nucleostring)%3 == 0:
for i in range(0, len(nucleostring),3):
c= nucleostring[i: i+3]
print(c)
I want print output horizontally
O/p:
Enter the number of base: 6
AATGCA
Forward
DNA Seq
AAT
GCA
Instead of these I need print horizontally AAT GCA
1
Expert's answer
2021-10-12T07:39:48-0400
import time


#nucleotides="ATGC"

nucleotides="AATGCA"

nulength= len(nucleotides)


nucleostring=""


noofbase=0
inputbase= int(input("Enter the number of base: "))


while noofbase < inputbase:
  rand=int(time.time_ns())
  randomno=rand%nulength
  nucleostring+=nucleotides[randomno]
  noofbase+=1
print(nucleostring)
print("Forward: ")
print("DNA Seq")


if len(nucleostring)%3 == 0:
  for i in range(0, len(nucleostring),3):
    c= nucleostring[i:i+3]
    print(c,end=' ')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS