File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,3 +6,5 @@ requires-python = ">=3.10"
66
77[tool .unittest ]
88# No special configuration needed, unittest is standard library
9+ [tool .vercel ]
10+ entrypoint = " math.Happy-Number.Happy-Number:app"
Original file line number Diff line number Diff line change 1+ print ("🔐 Caesar Cipher Encoder & Decoder 🔐" )
2+ print ("Encrypt and decrypt messages using Caesar Cipher\n " )
3+
4+
5+ def encrypt (text , shift ):
6+
7+ result = ""
8+
9+ for char in text :
10+
11+ if char .isupper ():
12+ result += chr ((ord (char ) - 65 + shift ) % 26 + 65 )
13+
14+ elif char .islower ():
15+ result += chr ((ord (char ) - 97 + shift ) % 26 + 97 )
16+
17+ else :
18+ result += char
19+
20+ return result
21+
22+
23+ def decrypt (text , shift ):
24+
25+ return encrypt (text , - shift )
26+
27+
28+ while True :
29+
30+ print ("=" * 50 )
31+ print ("🎯 Choose an option:" )
32+ print ("1️⃣ Encrypt Text" )
33+ print ("2️⃣ Decrypt Text" )
34+ print ("3️⃣ Exit" )
35+ print ("=" * 50 )
36+
37+ choice = input ("\n ➡️ Enter your choice (1-3): " )
38+
39+ if choice == '1' :
40+
41+ text = input ("\n 📝 Enter text to encrypt: " )
42+ shift = int (input ("🔑 Enter shift value: " ))
43+
44+ encrypted = encrypt (text , shift )
45+
46+ print (f"\n 🔐 Encrypted Text: { encrypted } \n " )
47+
48+ elif choice == '2' :
49+
50+ text = input ("\n 📨 Enter text to decrypt: " )
51+ shift = int (input ("🔑 Enter shift value: " ))
52+
53+ decrypted = decrypt (text , shift )
54+
55+ print (f"\n 📝 Decrypted Text: { decrypted } \n " )
56+
57+ elif choice == '3' :
58+
59+ print ("\n 👋 Thanks for using Caesar Cipher! Goodbye!\n " )
60+ break
61+
62+ else :
63+ print ("\n ❌ Invalid choice! Please select 1-3.\n " )
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ function getProjectHTML(projectName) {
3939 '2048-game' : ( ) => get2048GameHTML ( ) ,
4040 'productive-pet' : ( ) => getProductivePetHTML ( ) ,
4141 'color-palette' : ( ) => getColorPaletteHTML ( ) ,
42+ 'caesar-cipher' : ( ) => getCaesarCipherHTML ( ) ,
4243 } ;
4344
4445 try {
@@ -3630,7 +3631,8 @@ function initializeProject(projectName) {
36303631 'simon-says' : 'initSimonSays' ,
36313632 '2048-game' : 'init2048Game' ,
36323633 'color-palette' : 'initColorPalette' ,
3633- 'math-quiz' : 'initMathQuiz'
3634+ 'math-quiz' : 'initMathQuiz' ,
3635+ 'caesar-cipher' : 'initCaesarCipher'
36343636 } ;
36353637
36363638 const initializerName = initializers [ projectName ] ;
You can’t perform that action at this time.
0 commit comments