PYTHON CODE PLEASE. SHOW STEPS AND A SCREENSHOT OF THE CODE PLEASE. I think we can modify the code so that it can take i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

PYTHON CODE PLEASE. SHOW STEPS AND A SCREENSHOT OF THE CODE PLEASE. I think we can modify the code so that it can take i

Post by answerhappygod »

PYTHON CODE PLEASE. SHOW STEPS AND A SCREENSHOT OF THE CODEPLEASE.
I think we can modify the code so that it can take in input andoutput as a file instead of printing to the screen.
I need you to write the code that opens the file and reads theinput. In addition, I need you to write the informationinto another file called "answer.txt"
If you need help with these commands you will need:
I have done some modifications to the program already. Usethis template and find the places where we need to add input andout. Use this to add in the code for opening the filenamed "large_file.txt"
BELOW IS THE TEMPLATE THAT YOU NEED TO EDIT
# Petey Message Decoder
# Decodes the messagedef decrypt(message, key): LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' translated = "" for letter in message: if letter in LETTERS: value = chr((ord(letter)- ord('A') - key) % 26 + ord('A')) translated += value else: translated +=letter return translated
def main(): # Welcome Message print("Welcome to the Petey Message Decoder") print("------------------------------------") print("We will be trying to decode messages fromPetey.")
# TODO: Open Files
for l in range(24): # TODO: Read from file, decypt, andwrite files. decrypted_line = decrypt(line, 8) # TODO: Close Files
print("----------------------------") print("Done")
main()
YOU ONLY HAVE TO DO THE PARTS THAT SAY #TODO
BELOW IS THE INPUT FILE
EPIB'A I XQZIBM'A NIDWZQBM TMBBMZ? BPM TMBBMZ ZZZZZZZ!EPIB'A BPM JMAB VIUM NWZ I XQZIBM LWO? XIBKPMA!EPMZM LQL JTCMJMIZL BPM XQZIBM OMB PQA VIUM? WVM LIG, BPM AMI BPMEQVL KIUM IVL JTME PQA JMIZL ZQOPB WNN!EPG KIV'B XQZIBMA TMIZV BPM ITXPIJMB? JMKICAM BPMG AXMVL GMIZA IB"K"!EPIB'A BPM LQNNMZMVKM JMBEMMV I XQZIBM IVL I KZIVJMZZG NIZUMZ? IXQZIBM JCZQMA PQA BZMIACZM, JCB I KZIVJMZZG NIZUMZ BZMIACZMA PQAJMZZQMA.EPIB PIA 8 TMOA, 8 IZUA, IVL 8 MGMA? 8 XQZIBMA.EPG KWCTLV'B BPM XQZIBM KZME XTIG KIZLA? JMKICAM BPM KIXBIQV EIAABIVLQVO WV BPM LMKS!EPG LWV'B XQZIBMA APWEMZ JMNWZM BPMG EITS BPM XTIVS? JMKICAMBPMG'TT RCAB EIAP CX WV APWZM TIBMZ.EPIB LW GWC KITT I XQZIBM BPIB TQSMA BW ASQX AKPWWT? KIXBIQVPWWSG!EPIB LWMA BPM XQZIBM AIG EPMV PQA TMO OMBA ABCKS QV BPM NZMMHMZ?APQDMZ UM BQUJMZA!EPIB LQL BPM WKMIV AIG BW BPM XQZIBM? VWBPQVO, QB RCAB EIDML.PWE LW XQZIBMA XZMNMZ BW KWUUCVQKIBM? IGM BW IGM!EPMZM KIV GWC NQVL I XQZIBM EPW PIA TWAB PQA EWWLMV TMOA? ZQOPBEPMZM GM TMNB PQU.PWE LQL BPM XQZIBM OMB PQA RWTTG ZWOMZ AW KPMIX? PM JWCOPB QB WVAIQT.EPG QA XQZIBQVO AW ILLQKBQDM? BPMG AIG WVKM GM TWAM GMZ NQZAB PIVL,GM OMB PWWSML.PWE UCKP LQL BPM XQZIBM XIG NWZ PQA XMO IVL PWWS? IV IZU IVL ITMO.PWE LW GWC UISM I XQZIBM NCZQWCA? BISM IEIG BPM X.EPIB'A I XQZIBM'A EWZAB MVMUG? BMZUQBMAEPIB TQMA IB BPM JWBBWU WN BPM WKMIV IVL BEQBKPMA? I VMZDWCAEZMKS.EPG QA XQZIBQVO AW ILLQKBQDM? BPMG AIG WVKM GM TWAM GMZ NQZAB PIVL,GM OMB PWWSML!EPIB LW GM KITT I XQZIBM EQBP BEW MGMA IVL BEW TMOA? IZWWSQM.EPIB IZM BPM 10 TMBBMZA WN BPM XQZIBM ITXPIJMB? Q, Q, Z, IVL BPMAMDMV K'A!EPIB'A I XQZIBM'A NIDWZQBM BGXM WN MFMZKQAM? BPM XTIVS!PWE UCKP LQL BPM XQZIBM XIG NWZ PQA MIZQVOA? I JCKS-IV-MIZ.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply