-2
import sys
from time import sleep

#blocked sites
blocked_sites = ["youtube.com" , 'www.youtube.com' , 'www.facebook.com' , 'facebook.com']
input_request ='true'
while(input_request == 'y' or 'Y'):

    #user request
    input_inquriy= (input(' Enter the website that you would like to visit: '))


    #site filtering
    if(input_inquriy == blocked_sites ): #website not allowed
        print('website access disallowed')
        input_reqest = (input ( ' Would you like to submit another website request ( Y / N) '))
        if (input_reqest == 'Y' or 'y'):
            print(' Website revalidation requested')

        else:
            print(' have a nice afternoon then ')
            quit()
else:
    print( ' Website Access Granted ')
Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
  • Attempting to create a website filtering program. Appears that the array and the if statement are coordinating properly. Program should announce that if a website is in the array it is disallowed and ...etc but if not then it should be granted – medic117 Sep 13 '22 at 23:12
  • What are you asking? Your code is broken here: `input_request ='true' while(input_request == 'y' or 'Y')...` ...you will never enter the while loop, you define the variable as impossible right above the loop – ViaTech Sep 13 '22 at 23:14
  • `input_inquriy == blocked_sites` doesn’t check whether the string is present in an array. Change it to `input_inquriy in blocked_sites` – tenuki Sep 13 '22 at 23:15

1 Answers1

-1

as per comments, there are still several issues behind the ask. I would recommend clarifying what's wrong. I also recommend the suggested tweaks:

  1. changing the if statement to use the keyword in instead of ==.
  2. I also fixed typos of variable names.
  3. i tried to standardized string usage.
  4. i fixed other minor cosmetic issues that might be causing issues.

Hope this helps

import sys
from time import sleep

#blocked sites
blocked_sites = ['youtube.com', 'www.youtube.com', 'www.facebook.com', 'facebook.com']
input_request = True
while(input_request == 'y' or 'Y'):

    #user request
    input_inquiry= input(' Enter the website that you would like to visit: ')


    #site filtering
        if input_inquiry in blocked_sites: #website not allowed
            print('website access disallowed')
            input_request = (input ( ' Would you like to submit another website request (Y/N) '))
            if (input_reqest == 'Y' or input_reqest =='y'):
                print(' Website revalidation requested')
    
            else:
                print(' have a nice afternoon then ')
                quit()
        else:
            print( ' Website Access Granted ')
            break
Amit Shah
  • 3
  • 4