Question
Hi, could you please help me solve this python3 question? Note: this must be in Python This is the previous instructions & script that I
Hi, could you please help me solve this python3 question? Note: this must be in Python
This is the previous instructions & script that I wrote:
Oh no! The nefarious Doctor Doom is planning on hacking into the satellite broadcasting system to spread his maniacal message of misdoing across the planet. We need to make sure that he cant get his way! Use what you learned in this section about Python in order to create some sort of super secret security script that will let the technicians access the system but keep that diabolical delinquent Doom locked out!
Your script should take in a four digit code, check each of the digits, and then, assuming they are all correct, grant access to the system. If only some of the digits are correct, the script should output how many of the digits are correct, just in case the technicians have forgotten some of the code. With your help, Doom doesnt stand a chance!
Input string | Expected output of script |
Enter code: 8756 Enter code: 4752 Enter code: 3942 Enter code: 5962 Enter code: 1962
| 0 digits correct 1 digits correct 2 digits correct 3 digits correct Access granted! |
This is the code I wrote for the previous assignment:
#!/usr/bin/python3
correct_code = "1962"
code = input("Enter code: ")
if len(code) == 4:
count = 0
for i in range(4):
if code[i] == correct_code[i]:
count += 1
if count == 4:
print("Access granted!")
else:
print(count, "digits correct")
else:
print("Correct Code is 4-digits")
Now, here is the NEW assignment that I need help with PLEASE:
A security script?? What fools! No one may stop the mighty DOCTOR DOOM from accessing the satellite broadcasting system. Ill show those bumbling do-gooders that it is DOOM who will be victorious. You will use what you have learned in this section in order to create a script that will run the so called security script created by those overzealous oafs and get access to the satellite broadcasting system. DESTROY THE ONLY THING STANDING BETWEEN DOOM AND COMPLETE POWER OVER ALL THE WORLDS SATELLITE BASED MEDIA BROADCASTING. Soon the whole world will hear the message of DOOM!!!
Yikes, he seems pretty heated. Better do what he says. Try using import to run the extra credit script from the previous section and see if you can crack it! Points will be awarded for most creative solution
Example input | Expected output of script |
./scriptcracker.py script.py | 0 digits correct 1 digits correct 2 digits correct 3 digits correct Access granted! |
Thanks a lot!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started