Passing Arguments to IDLE

Hi there, I am trying to code in my IDLE. However, I am not able to figure out how to pass correctly all the string arguments to my code. Any help will be greatly appreciated.
Thank you

  1. import sys

  2. def ShortestLen (valor):

  3.    shortestL = len (min (valor, key = len))
  4.    return int (shortestL)
  5. valor = str (sys.argv[1:])

  6. valoradj = valor.strip(’ ')

  7. numeroletras = ShortestLen (valor)

  8. resultado = [palabraf.upper() for palabraf in valoradj if len (palabraf) == numeroletras]

  9. print (“The shortest word is”, resultado [0])

Try Run->Run…Customized.


For the future: If Matthew’s answer is what you want, a better title would be “Passing arguments to code run from IDLE editor”. As is, I thought you meant passing arguments to IDLE when starting IDLE on a command line with python -m idlelib <arguments>.

Also, post code without line numbers between triple backticks.

your lines
of code
1 Like

Got it.
Thank you. I will.