CopyPastor

Detecting plagiarism made easy.

Score: 0.8006415367126465; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-09-03
by Mishan\_Rai

Original Post

Original - Posted on 2019-10-31
by Bach



            
Present in both answers; Present only in the new answer; Present only in the old answer;

yo mate! I am too lazy to explain but here is the code: ``` def get_index(word): while True: try: index = int(input("Enter an index: ")) if index == -1: return index elif index >= len(word): print ("invalid index") elif index <= -1: print ("invalid index") else: return index except ValueError: print ("invalid index") def get_letter(): while True: letter = str(input("Enter a letter: ")) if letter.islower() and len(letter)==1: return letter elif not letter.islower(): print ("Character must be a lowercase letter!") elif len(letter) > 1: print ("Must be exactly one character!")
def word_ladder(word): while True: index = get_index(word) if index == -1: return else: letter=get_letter() word = list(word) word[index] = letter word = ("").join(word) print (word)
word = input("Enter a word: ")
word_ladder(word)
```
Word Ladder should keep running and keep printing the results until the index is -1. Here is a quick solution. ----------------------------------- # play word ladder ``` def get_index(word): while True: try: pos = int(input("Enter an index: ")) if pos == -1: return pos elif pos >= len(word): print "invalid index" elif pos <= -1: print "invalid index" else: return pos except ValueError: print "invalid index" def get_letter(): while True: char = str(input("Enter a letter: ")) if char.islower() and len(char)==1: return char elif not char.islower(): print "Character must be a lowercase letter!" elif len(char) > 1: print "Must be exactly one character!" def word_ladder(word): while True: pos = get_index(word) if pos == -1: return else: char=get_letter() word = list(word) word[pos] = char word = ("").join(word) print word word = input("Enter a word: ") word_ladder(word) ```

        
Present in both answers; Present only in the new answer; Present only in the old answer;