Question: I need help with adding the weighted points at the end of every subject please in python def validate _ input ( message , offset

I need help with adding the weighted points at the end of every subject please
in python
def validate_input(message, offset):
if not (0= offset =26):
return False
for char in message:
if not (char.isalpha() or char.isspace()):
return False
return True
def caesar_cipher(message, offset):
encrypted_message =[]
for char in message:
if char.isalpha():
shifted = ord(char.upper())+ offset
if shifted > ord('Z'):
shifted -=26 # Wrap around if it goes past 'Z'
encrypted_message.append(chr(shifted))
else:
encrypted_message.append(char)
return ''.join(encrypted_message)
def main():
while True:
message = input("Enter your message: ""
")
try:
offset = int(input("Enter the offset value: "))
except ValueError:
print("Offset must be an integer.")
continue
if validate_input(message, offset):
encrypted_message = caesar_cipher(message, offset)
print(f"
Your secret message is...{encrypted_message}")
else:
print(
"Sorry, we can only process messages with letters and spaces, and the offset must be between 0 and 26.")
another = input("
Do you want to encrypt another message?: ").strip().lower()
if another !='y':
print("
Closing out...")
break
if __name__=="__main__":
main()
 I need help with adding the weighted points at the end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!