Giter Site home page Giter Site logo

Comments (4)

K0MPLEXWorksTogether avatar K0MPLEXWorksTogether commented on July 19, 2024

Can I take this up. I already have written some code for this.
Check it out:
https://replit.com/@AbhiramMangipud/Caeser-Cipher
Btw, there are more program's available on my Replit. Ping me if you need anything, or else, use anything you want.
Here's a small preview of my code:

import art
# Printing The Cool ASCII Art.
print(art.logo)

# Maintain A List Of ALl The English Alphabet.
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

def caesar(start_text, shift_amount, cipher_direction):
    # Maintaining End Text.
    end_text = ""

    # Check For Direction Of Cipher.
    if direction == "encode":
      pass
    elif direction == "decode":
      shift_amount *= -1
    else:
      print("You have entered an invalid ciphering direction. Try again.")
      return None

    # Adding Elements To The Cipher Text.
    for letter in start_text:
      if letter in alphabet:
        position = alphabet.index(letter)
        new_position = (position + shift_amount) % 26
        end_text += alphabet[new_position]
      else:
        end_text += letter
    # Displaying Cipher Text.
    print(f"The {cipher_direction}d text is: {end_text}")

# Game Loop.
goAgain = True
while(goAgain):
  direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n")
  text = input("Type your message:\n").lower()
  shift = int(input("Type the shift number:\n"))

  caesar(start_text=text, shift_amount=shift, cipher_direction=direction)

  another_try = input("Enter 'go' if you want to go again. Else enter 'stop'.\n")
  if another_try == 'go':
    pass
  elif another_try == 'stop':
    print("Goodbye Then!")
    goAgain = False
  else:
    print("You have entered invalid choice. Stopping...")
    goAgain = False

from 100linesofcode.

KnochenMarkSaege avatar KnochenMarkSaege commented on July 19, 2024

@K0MPLEXWorksTogether not 100% sure if I'm interpreting your message correctly,
but if you're asking me, if you can use my code for the caesar's cipher:
sure, go ahead.
The second I contributed it to this repo I considered it Open Source, so it's available to be used for everyone who finds it :)

from 100linesofcode.

K0MPLEXWorksTogether avatar K0MPLEXWorksTogether commented on July 19, 2024

I'm so sorry. I didn't know about you opening this issue, to get an approval for your pull request. I thought the issue was up for taking.

from 100linesofcode.

KnochenMarkSaege avatar KnochenMarkSaege commented on July 19, 2024

I think the owner of the repo isn't actively maintaining it anymore.
But you can still feel free to use my code, if you want to, np for me :)

from 100linesofcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.