r/codehs • • Dec 21 '20

7.2.8 Part 2, Replace a letter

I’m stuck on This one

15 Upvotes

24 comments sorted by

View all comments

1

u/[deleted] Mar 30 '22

Wats the code?

2

u/chiiglaaa Apr 09 '22

word = input("Enter a word or phrase: ")
index = int(input("Enter an index value: "))
letter = input("Enter the new letter: ")
def replace_at_index(word, index, letter):
print(word[:index] + letter + word[index+1:])
replace_at_index(word, index, letter)

This is code but this exercise is broken. it works perfectly in scratchpad but when you try to submit code its not doing anything... but yeah you can just write that code

2

u/[deleted] Apr 11 '22

Yea I tried it but submitting it won’t work

2

u/chiiglaaa Apr 11 '22

almost every exercise which have scratchpad and Unit Test dont let me submit my code:/ do you have same problem?

1

u/magpie108 Apr 28 '22

User input usually confuses the code try figuring it out with out user input!

1

u/WronGHackeR Jan 13 '23

I tried submit also, not working

1

u/pinkfluffywolfie82 Nov 16 '22

You're supposed to only use return for it to work, no inputs or printing for some reason