0
def modify_last(txt, n): s=txt[:] d=txt[-1]*n s,d=gather return "".join(gather) modify_last("Hello", 3) #➞ "Hello
How can I repeat the last index of string by number (n)? Does my code works well .forget the indentation
5 Réponses
+ 2
You should first replace that actual code and question with each other for readability ,and use python and string as separate tags
+ 2
Your code works well ,so what is the actual error you are getting?
+ 1
Actully its working but in sublime it says error
+ 1
jäbbar then you should have mentioned the actual issue ,I have no idea about working with sublime so can't help further ,sorry , hopefully someone else can assist you
0
I have another question #Abhay
I have a dictionary with keys of string and once the input is key (string) I want output numbers
Here is sample
print("one") output 1 hopefully its clear