def is_valid_url(url):
# Check if the URL starts with http:// or https://
if not (url.startswith(‘http://’) or url.startswith(‘https://’)):
return False
# Define allowed characters
allowed characters: str = ‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’
symbols: str = ‘._~-/?#[]@!$&’*+‚;=:% ‘
allowed = set(alph + symbols)
# Check each character in the URL
for char in url:
if char not in allowed:
return False
return True