Created
January 29, 2023 20:44
-
-
Save antonengelhardt/11878b21c40cae2d19ea6e56546b04ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
def main(): | |
word = ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'] | |
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', '!'] | |
current_word = '' | |
for i in range(len(word)): | |
for j in range(len(alphabet)): | |
print(current_word + alphabet[j]) | |
sleep(0.05) | |
if word[i] == alphabet[j] or word[i] == alphabet[j].upper(): | |
current_word = current_word + alphabet[j] | |
break | |
if __name__ == '__main__': | |
main() |
@Izhaan-Raza Sure.
public class HelloWorld {
public static void main(String[] args) {
char[] word = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
char[] 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', '!'};
String currentWord = "";
for (int i = 0; i < word.length; i++) {
for (int j = 0; j < alphabet.length; j++) {
System.out.println(currentWord + alphabet[j]);
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (word[i] == alphabet[j] || word[i] == alphabet[j] - 32) {
currentWord += alphabet[j];
break;
}
}
}
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how can i do this in java