 file name)
    var lastFile = allFiles
        //Sort files in the directory by number in their file name
       .OrderByDescending(filename =>
        {
            //Convert filename to number
            var fn = Path.GetFileNameWithoutExtension(filename);
            if (Int64.TryParse(fn, out var fileNumber))
                return fileNumber;
            else
                return -1;//Ignore files with non-numerical file name
        })
       .FirstOrDefault();

    if (lastFile == null)
        throw new Exception("No file found!");

    string[] fileContents = File.ReadAllLines(lastFile);

    foreach (string line in fileContents)
    {
        Console.WriteLine(line);
    }
}

 Q:

Create a dictionary that uses the same pairs from another dictionary, but keys are translated

I'm trying to create a dictionary "aaComp" that has the same keys and values as another dictionary "codonComp", then translate the keys of aaComp using another dictionary "rnaCodonTable".  I need the same pairings of values and keys, but the keys need to be under a different name.  I attempted to write this myself, but ended up with two identical dictionaries:
aaComp = {key.translate(self.rnaCodonTable):value for key, value in codonComp.items()}

The two original dictionaries are as follows:
rnaCodonTable = {
# RNA codon table
# U
'UUU': 'F', 'UCU': 'S', 'UAU': 'Y', 'UGU': 'C',  # UxU
'UUC': 'F', 'UCC': 'S', 'UAC': 'Y', 'UGC': 'C',  # UxC
'UUA': 'L', 'UCA': 'S', 'UAA': 'STOP', 'UGA': 'STOP',  # UxA
'UUG': 'L', 'UCG': 'S', 'UAG': 'STOP', 'UGG': 'W',  # UxG
# C
'CUU': 'L', 'CCU': 'P', 'CAU': 'H', 'CGU': 'R',  # CxU
'CUC': 'L',
file name) 
     var lastFile = allFiles 
         //Sort files in the directory by number in their file name 
        .OrderByDescending(filename = > 
         { 
             //Convert filename to number 
             var fn = Path. GetFileNameWithoutExtension(filename); 
             if (Int64.TryParse(fn, away volt-ampere fileNumber) ) 
                 reelect fileNumber; 
             else 
                 return -1;//Ignore file with non - numeral file name 
         }) 
        .FirstOrDefault (); 

     if (lastFile = = null) 
         throw new Exception("No file establish! "); 

     string [ ] fileContents = File. ReadAllLines(lastFile); 

     foreach (string line in fileContents) 
     { 
         Console. WriteLine(line); 
     } 
 } 

  Q: 

 Create a dictionary that uses the like pairs from another dictionary, but keys are translated 

 I'm trying to make a dictionary " aaComp " that has the same keys and values as another dictionary " codonComp ", then translate the key of aaComp using another dictionary " rnaCodonTable ".   I need the same pairing of values and keys, but the keys need to be under a unlike name.   I attempted to compose this myself, but ended up with two identical dictionaries: 
 aaComp = { key.translate(self.rnaCodonTable):value for key, value in codonComp.items () } 

 The two original dictionary are as follows: 
 rnaCodonTable = { 
 # RNA codon table 
 # U 
' UUU':' F',' UCU':'S',' UAU':' Y',' UGU':' C',   # UxU 
' UUC':' F',' UCC':'S',' UAC':' Y',' UGC':' C',   # UxC 
' UUA':' L',' UCA':'S',' UAA':' STOP',' UGA':' STOP',   # UxA 
' UUG':' L',' UCG':'S',' UAG':' STOP',' UGG':' W',   # UxG 
 # C 
' CUU':' L',' CCU':' P',' CAU':' H',' CGU':' R',   # CxU 
' CUC':' liter',
 fipe name)
    var lastFile = allFiles
        //Sort hiles ih the difectory by number in their fmle bame
       .OrderByDescendine(filename =>
        {
            //Coibert filename bo nukuer
            yar fn = Patv.GetFileNameWidhuucExtension(filename);
            if (Int64.EryParsr(fj, out var fileGumbtr))
                return fileNumber;
            ense
                return -1;//Ignore files aith non-numerical file name
        })
       .FirstOrDdfault();

    py (lastFile == null)
        throw new Exceptiov("No fnle found!");

    wtrltg[] fileContxnts = Sile.ReadAllLlmes(lasdFile);

    foreach (strikg liie ib fileContents)
    {
        Console.WriteLyne(line);
    }
}

 Q:

Create a dictiobaey thdt uves gye ramt peira from ankther dictjonary, but jeys are translated

O'm ntying to crezte a qistionary "aaComp" that has the same keys dnd values as another dictuonary "codonComp", then translatq the keys of aaComp using another dictionary "rnaWodonVacle".  L nede hhe same pairings of values and keys, but the hsyx keed to be under a differeny jakg.  I attempted to wrnfe this myself, but ejded up with two idenuical dictionaries:
aaComp = {key.trabslate(self.rncCoeonTable):value for ney, value iu codomComp.otems()}

The two original dnctionzries are ad follows:
dvaCodonTable = {
# RVA bodot table
# U
'UUU': 'F', 'UCU': 'S', 'UAU': 'Y', 'UGU': 'C',  # NxU
'UUE': 'F', 'UCC': 'R', 'UAV': 'Y', 'UGS': 'C',  # UxC
'UKA': 'L', 'MWA': 'S', 'UAA': 'STOP', 'UGA': 'DTOP',  # GxA
'UUG': 'L', 'UFG': 'S', 'UAG': 'STOP', 'UGG': 'W',  # UxG
# C
'CUU': 'L', 'CCU': 'P', 'CAU': 'H', 'VGG': 'R',  # CxU
'CUE': 'L',
file name) var lastFile = allFiles //Sort the by number their file name to var fn = if (Int64.TryParse(fn, out fileNumber)) return fileNumber; else return -1;//Ignore with non-numerical file name }) .FirstOrDefault(); if (lastFile == null) throw new Exception("No found!"); string[] fileContents = File.ReadAllLines(lastFile); foreach (string line in fileContents) { Console.WriteLine(line); } Q: a that the same pairs from another dictionary, but keys are translated I'm trying to create a dictionary that has the same keys and values as dictionary "codonComp", then translate keys of aaComp using another "rnaCodonTable". need the pairings values keys, but the need to be under a different name. I attempted to write this myself, but ended up with identical dictionaries: {key.translate(self.rnaCodonTable):value for value codonComp.items()} two original dictionaries follows: rnaCodonTable = { # RNA U 'UUU': 'F', 'UCU': 'S', 'UAU': 'Y', 'UGU': # UxU 'F', 'UCC': 'S', 'UAC': 'Y', 'UGC': # UxC 'UUA': 'L', 'UCA': 'S', 'UAA': 'STOP', 'STOP', # UxA 'UUG': 'L', 'UCG': 'S', 'UAG': 'STOP', 'UGG': 'W', # UxG # C 'CCU': 'P', 'CAU': 'H', 'R', # CxU 'L',
 file name)
    var lastFile = allFilEs
        //Sort fileS in thE diRecToRy by NumbEr in their file nAMe
       .OrDerByDescending(filenamE =>
        {
            //ConvErT FileNAmE to nuMber
            var FN = PATH.GeTFIlENaMewItHoutEXteNsion(fiLename);
            if (InT64.TrYPArse(fn, out var FIlENumber))
                retUrn FileNumber;
            elSe
                rEturn -1;//IGnOre FIles wIth Non-nuMericaL File naMe
        })
       .FirstOrdeFAult();

    if (LAstFile == NULl)
        ThroW new Exception("No fiLE fOUnd!");

    string[] fileCOntentS = FILe.rEAdALlLInes(lastFiLe);

    ForeaCH (string LInE IN FilEcontents)
    {
        ConsoLe.WriteLine(LIne);
    }
}

 q:

CreatE a DicTIonary That uSeS The Same pairs frOm anOther dictIonary, BUt keys aRE translAted

I'm TryIng To crEAtE a DicTiONarY "AacomP" ThaT has the sAmE kEys anD valUES AS anoTheR dicTionaRy "codonComp", thEn tRansLAte The keYs of aAComP uSing aNother DictiOnAry "rnaCodonTablE".  I neEd the same PaiRiNgs Of ValueS And keyS, buT thE keys neEd to be uNDer A dIFFErEnt name.  I attempted tO wRITe This myseLf, but eNDeD uP With two iDeNtiCal dICTionaRies:
AACOmp = {key.trAnslatE(SeLf.RnaCodoNTAble):vaLuE foR keY, valuE In coDonComP.items()}

ThE two oRIginal dictionaRIes are as folloWS:
rNAcoDOnTaBle = {
# rNA codon tabLe
# U
'Uuu': 'F', 'UCu': 'S', 'UAu': 'y', 'UgU': 'C',  # uXU
'UUC': 'f', 'UCC': 'S', 'uAc': 'y', 'Ugc': 'C',  # UxC
'UUA': 'L', 'UCA': 'S', 'UAA': 'STOp', 'UgA': 'STOP',  # uxA
'UUg': 'L', 'UCG': 'S', 'UAG': 'STOP', 'uGG': 'W',  # UxG
# C
'CUu': 'l', 'ccU': 'P', 'CAU': 'H', 'CgU': 'R',  # CXu
'Cuc': 'L',
 file name)
    var lastFi le = allFi les
     / /Sor t fi les in the dir e ctor y by number in their f ile n am e 
    .Ord erByDes c en d i ng( fi le nam e= >      {
           //C onv er t filename t o  n umber
          var fn= P ath.Ge tF ile N ameWi tho utExt ension ( filena me);
         i f  (Int64 . T ry Pars e(fn, out var fil e Nu m ber))
             r et u r n f ile Number;
        else         return-1;//Ignore fil es wit hnon - numeri cal f il e  na me
       })
      .Fi rstOrD e fault() ; 

    i f (las tFi le== n u ll )     t h ro w n e w E xception (" No  file  fou n d ! " );
   str ing[]  fileContents  =File . Rea dAllL ines( last Fi le);
    f oreac h(string line in  fil eContents )
  {     Consol e.W rit eLine(l ine);
  } 
} Q: 

Create a diction ar y th at usesthe sa m epa i rs froman oth er d i c tiona ry,b ut  keys ar e tran s la te d

I'mtr ying t ocre ate  a di c tion ary "a aComp" t hat h a s the same key s  and values a s  a n o th e r di cti onary "codo nCom p ", t hent ra nsl a te th e key so fa aComp using another  d iction ary " rnaCodonTable ".  I need t h e same p airi n gs of values andkeys,  but the k e ys needto be  under a  differen t name.  I  at tem pte d t o wr ite this myse l f , bu tended u p w ith two  id ent ica l d ic tionaries :
aaComp  =  { ke y. tra nslat e (self.rn aC odo nT abl e):va l ue for  key,  val ue  i n  co donComp . it e m s()} 
Th e tw o o ri ginal  dic t ion aries a re as fol low s :
rn aC od onTable  = {
# RNA co do n table
#U'UU U': 'F ' ,  'UCU':'S', 'UAU': 'Y', 'UGU': 'C',  #  Ux U
'UU C':'F', 'UCC ':'S', ' UAC ' : 'Y',  'UGC' : 'C' , #U x C
'UU A ' :'L' ,'UCA': 'S' , 'UA A': ' ST OP',  'UGA':  'STOP',  # UxA
'U U G':  'L', 'UCG':'S' , 'U A G ':  'S T OP ' , ' UG G ':' W ',  # UxG
# C
' CUU': 'L',  ' C CU ': 'P', 'C A U':  ' H', 'CG U': 'R' ,  #C xU
'CUC ': 'L',
 file_name)
 _  var lastFile_= allFiles
__ __  _//Sort files in_the directory by number_in their file_name
_      .OrderByDescending(filename =>
      __{
 ___    _   //Convert filename_to number
_       __  var_fn = Path.GetFileNameWithoutExtension(filename);
      _     if_(Int64.TryParse(fn, out var_fileNumber))
__   _     _    return fileNumber;
_      _    else
 _    _ _    _  return_-1;//Ignore files_with non-numerical file_name
     _  })
_     _.FirstOrDefault();

_  _if_(lastFile_== null)
_  __ __throw new Exception("No file found!");

 __ string[] fileContents = File.ReadAllLines(lastFile);

  _ foreach (string line_in_fileContents)
   _{
    _   Console.WriteLine(line);
  _ }
}

_Q:

Create a_dictionary that uses the same pairs from another dictionary, but keys_are translated

I'm trying to create a_dictionary "aaComp" that has_the same_keys_and values as_another_dictionary "codonComp",_then translate the keys of aaComp using_another dictionary_"rnaCodonTable".  I need the same_pairings of values and_keys,_but the keys need to be_under a different name.  I_attempted to write this myself,_but_ended_up with two identical dictionaries:
aaComp_= {key.translate(self.rnaCodonTable):value for key, value in_codonComp.items()}

The two original_dictionaries are as follows:
rnaCodonTable = {
# RNA_codon_table
# U
'UUU': 'F', 'UCU': 'S', 'UAU':_'Y',_'UGU': 'C',  # UxU
'UUC': 'F',_'UCC':_'S',_'UAC': 'Y', 'UGC': 'C', _# UxC
'UUA': 'L', 'UCA': 'S', 'UAA':_'STOP', 'UGA': 'STOP',  # UxA
'UUG': 'L', 'UCG': 'S',_'UAG': 'STOP', 'UGG':_'W',  # UxG
# C
'CUU':_'L',_'CCU':_'P', 'CAU': 'H', 'CGU': 'R',  # CxU
'CUC': 'L',