Ask coding questions

← Back to all posts process died unexpectedly
MichaelFaulkner (24)

Python code won't run. It says that the process died unexpectedly. Is this replits fault or mine?

Answered by heyitsmarcus (347) [earned 5 cycles]
View Answer
heyitsmarcus (347)

You had just a couple things going wrong with your program:
1) Your while loop has to exit at some point. It was dependent on count not being equal to the length of note. But, count was never modified so the while loop is infinite and breaks Python. A simple fix was adding count += 1 to the next line.
2) Once that was fixed, you had an append command on a string. You only need to append your arrays here. With strings, you would do last_note += i.
3) And then you want the user to see the encoded string, so I put that as a print statement.

I made a fork of your program that you can see here:

print('Welcome to the encryptor.')
menu = input('Would you like to encode or decode a note? ')
letters = [
    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
    "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ' ']
cyphertext = [
  'K','D','G','F','N','S','L','V','B','W','A','H','E','X','J','M','Q','C','P','Z','R','T','Y','I','U','O', '!', 
def encode(note):
  new_note = []
  encoded_note = []
  last_note = ''
  count = 0
  while count != len(note):
    count += 1
  print('Encoding note...')
  for i in new_note:
    for letter in letters:
      if i == letter:
  for i in encoded_note:
    last_note += i

print(encode('This is a practice note'))
heyitsmarcus (347)

@heyitsmarcus Please upvote and accept my answer if you think this helped you!

ThunderGaming5 (0)

pls solve my problem i am on node.js it is coming process dies
the link is

AaravBhatia (0)

i have the same problem, well it's okay