Guys...questions.. are difficult...
I will try to post...all pls wait...😊
I will try to post...all pls wait...😊
❤3
def encrypt_decrypt(message, key_phrase):
words = message.split()
key_words = key_phrase.split()
reversed_key_words = key_words[::-1]
result = []
for i in range(len(words)):
if i < len(key_words):
current_key_word = reversed_key_words[i]
else:
current_key_word = reversed_key_words[i % len(key_words)]
result.append(words[i] + current_key_word)
return ' '.join(result)
if name == 'main':
message = input("Enter message: ")
key_phrase = input("Enter key phrase: ")
print(encrypt_decrypt(message, key_phrase))
Python3
words = message.split()
key_words = key_phrase.split()
reversed_key_words = key_words[::-1]
result = []
for i in range(len(words)):
if i < len(key_words):
current_key_word = reversed_key_words[i]
else:
current_key_word = reversed_key_words[i % len(key_words)]
result.append(words[i] + current_key_word)
return ' '.join(result)
if name == 'main':
message = input("Enter message: ")
key_phrase = input("Enter key phrase: ")
print(encrypt_decrypt(message, key_phrase))
Python3
👍5🔥1
Send the error pics i will solve..👇👇
decryptmessage
Guys plagiarism will be checked so please change method order and variable name
Share @Coding_000❤️
Guys plagiarism will be checked so please change method order and variable name
Share @Coding_000❤️
❤1🔥1
🔥To Apply For Latest Jobs and Internships and Offcampus links✅
🙋 Please Check 👇
https://t.me/Offcampus_000
🙋 Please Check 👇
https://t.me/Offcampus_000
❤1👍1
👍2👨💻1
IBM EXAM CODES
SHARE @CODING_000✅
SHARE @CODING_000✅
🔥2🥰1
👉 VIRTUSA
Exam Help Available
Note: It's Paid 💰💰
Msg: @ILOVEU_143
Test Clearance Guaranteed👨💻✅
Share @Coding_000 ❤️😊
Exam Help Available
Note: It's Paid 💰💰
Msg: @ILOVEU_143
Test Clearance Guaranteed👨💻✅
Share @Coding_000 ❤️😊
👍2🔥1
Capgemini pip exam help available
Exam Help Available
Note: It's Paid 💰💰
Msg: @ILOVEU_143
Test Clearance Guaranteed👨💻✅
Share @Coding_000 ❤️😊
Exam Help Available
Note: It's Paid 💰💰
Msg: @ILOVEU_143
Test Clearance Guaranteed👨💻✅
Share @Coding_000 ❤️😊
👍2
Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
Photo
public class StringSwap {
public static String performOperations(String initialString, int numOperations, int[] operationsArray) {
StringBuilder currentString = new StringBuilder(initialString);
for (int operation : operationsArray) {
if (operation == 1) {
char temp = currentString.charAt(0);
currentString.setCharAt(0, currentString.charAt(currentString.length() - 1));
currentString.setCharAt(currentString.length() - 1, temp);
} else if (operation == 2) {
int middle = currentString.length() / 2;
String firstHalf = currentString.substring(0, middle);
String secondHalf = currentString.substring(middle);
currentString = new StringBuilder(secondHalf + firstHalf);
}
}
return currentString.toString();
}
public static void main(String[] args) {
String initialString = "ABCD";
int numOperations = 2;
int[] operationsArray = {1, 2, 1};
String result = performOperations(initialString, numOperations, operationsArray);
System.out.println(result);
}
}
Virtusa in java✅🆓
Share @Coding_000❤️
public static String performOperations(String initialString, int numOperations, int[] operationsArray) {
StringBuilder currentString = new StringBuilder(initialString);
for (int operation : operationsArray) {
if (operation == 1) {
char temp = currentString.charAt(0);
currentString.setCharAt(0, currentString.charAt(currentString.length() - 1));
currentString.setCharAt(currentString.length() - 1, temp);
} else if (operation == 2) {
int middle = currentString.length() / 2;
String firstHalf = currentString.substring(0, middle);
String secondHalf = currentString.substring(middle);
currentString = new StringBuilder(secondHalf + firstHalf);
}
}
return currentString.toString();
}
public static void main(String[] args) {
String initialString = "ABCD";
int numOperations = 2;
int[] operationsArray = {1, 2, 1};
String result = performOperations(initialString, numOperations, operationsArray);
System.out.println(result);
}
}
Virtusa in java✅🆓
Share @Coding_000❤️
🔥1🥰1