I saw someone getting an assignment to implement the Vigenere Cipher, so I decided, just for the frig of it, to implement the Caesar Cipher. The algorithm below, however, doesn't account for spaces and punctuation. How can I account for those without redoing the whole thing? from random import choice from string import ascii_lowercase # for both encryption algorithms use negative offset to decrypt def caesar_cipher(text, offset): '''encrypts text with offset provided by user''' text, key = text.casefold(), ascii_lowercase cipher = [key[(key.index(char) + offset) % 26] for char in text if char in key] return cipher def caesar_cipher_rnd(text): '''generates and …

Member Avatar
Member Avatar
+0 forum 2

Onager Ornery Clicker presents a grid of buttons. One says "Click Me!" and the rest say "Don't Click Me!" Clicking the right button scores a point, while clicking the wrong button costs a point. After each click the buttons reshuffle. There is a timer you can start and stop. You can see how fast you can score x points, or how many points you can score in x time. I need both playtesters and code reviewers. Please comment on the look, playability and coding functionality/style. If you'd like to see features added or removed, please let me know. Here's the …

Member Avatar
Member Avatar
+0 forum 9

I'm developing a dirt-simple text editor for personal use, customized the way I like it. My biggest difficulty is with grasping how OOP works. Could you kindly review the following code and suggest improvements (or at least link further information)? Much appreciated. from tkinter import Tk, END, INSERT from tkinter.scrolledtext import ScrolledText from tkinter.filedialog import asksaveasfilename, askopenfilename class Scratchpad: def __init__(self, Tk): self.display = Tk() self.display.title("Onager Text Editor--<F7> save, <F5> open and insert") self.display.bind('<F7>', self.save_file) self.display.bind('<F5>', self.open_file) self.display.bind('<Control-c>', self.copy) self.display.bind('<Control-p>', self.cut) self.display.bind('<Control-v>', self.paste) def create_editor(self, ScrolledText): self.editing_window = ScrolledText(self.display) self.editing_window.configure(fg='gold', bg='blue', insertbackground='cyan', height='25', width='70', padx='12', pady='12', wrap='word', tabs='48', font='serif 12') …

Member Avatar
Member Avatar
+0 forum 6

This script is to be a 5x5 grid of buttons, one saying "Click Me" and the rest "Don't Click Me." A correct click scores a point, an incorrect click costs a point. The buttons get shuffled after each click. The player has 60 seconds to maximize his score. The script is incomplete because I'm having two problems: 1. The individual ttk widget styles are refusing to apply (only the global widget styles are applying). 2. There is an extraneous column at the right of frame2 that I can't get rid of despite monkeying with the row/column/span/configure setttings for a geological …

Member Avatar
Member Avatar
+0 forum 8

What software do you recommend for drawing layouts to be implemented in a ttk application? I'm looking for something simple and clutter-free where there aren't 10 zillion options I don't want. All I really need is basic shapes corresponding to the shapes of ttk widgets and a way to place them in the desired location within the drawing window. (I have only a standard tower with mouse and keyboard, and am not looking to purchase a drawing tablet, pen, or touchscreen display.) Thanks for all responses.

Member Avatar
Member Avatar
+0 forum 1

The End.