I’m still very new to python and I’m coding a simple program to decrypt a poem. The first thing that needs to be done is that the user puts in the poem, which is broken down into a list, where then the base pairs are put into binary. To sort them into binary I’ve tried using an If/Elif statement (posted below) but the code routinely only responds to the first half. It will only print the 1’s or 0’s depending on which I leave first in the code.
basic = list(input(“Enter the poem here!”))
trans = []
for n in basic:
temp = basic.pop(0)
print(temp)
if (temp == ‘T’ or temp == ‘G’):
temp = 1
elif (temp == ‘A’ or temp == ‘C’):
temp = 0
trans.append(temp)
amphibiian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.