python - Making for loop ignore something first time through -


i working on encryption assignment cs class , using logistic map part of changing characters ord() , chr().

for code using loop , need run once before using command(logmap)

from logistic import logmap genampseed import genampseed cipherchr import cipherchr  password=input("enter password: ") amp,seed=genampseed(password) line=input("enter line cipher: ")  def logmap(a,x):     ans=(a*x)*(1-x)     return ans  def line2cipher(amp,seed,line):     acc=''     in line:         res=logmap(amp,seed)         offset=int(96*res)         acc+= cipherchr(i,offset)     print(acc,res) 

so need run first time using defaults genampseed (genampseed.py) first time , use logmap defaults on

you can use slice ignore first character of string.

def line2cipher(amp,seed,line):     acc=''     in line[1:]:         res=logmap(amp,seed)         offset=int(96*res)         acc+= cipherchr(i,offset)     print(acc,res) 

edit:

if want more generic, can use flag check if it's first time loop running:

first = true in range(10):     if first:         first = false         # whatever need first time         continue     # something... 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -