Reversing the words of the sentence
Write a program that receives a sentence and reverses each word and re -print the sentence without changing the order of words.
Input: Hello Amir ...
Olleh RIMA ...
Write a program that receives a sentence and reverses each word and re -print the sentence without changing the order of words.
Input: Hello Amir ...
Olleh RIMA ...
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
r = input("matn: ") h = "" for i in r: # Reverse the string h = i + h print(h)
a=[] b=(input('str:')) for i in b: a.append(i) for j in reversed(a): print(j,end="")
def reverse_words_in_sentence(sentence): words = sentence.split() reversed_words = [word[::-1] for word in words] return ' '.join(reversed_words) sentence = input("Enter a sentence: ") print(reverse_words_in_sentence(sentence))
def reverse_words(sentence): """این تابع کلمات یک جمله را برعکس میکند.""" # Divide the sentence into words words = sentence.split() # Reversing any word reversed_words = [word[::-1] for word in words] # Converting the list of inverse words into a sentence reversed_sentence = ' '.join(reversed_words) return reversed_sentence def main(): # Receive a sentence from the user sentence = input("لطفاً یک جمله وارد کنید: ") # Reversing the words and printing the result result = reverse_words(sentence) print(result) # Implementation of the program main()
en_string = input ('str: ') rev = [i[::-1] for i in en_string.split()] rev_u = " ".join(rev) print (f'{rev_u} --> {en_string}')
def reverse_words(sentence): # Separate sentence words words = sentence.split() # Reversing any word and saving in the new list reversed_words = [word[::-1] for word in words] # Combining the inverse words into a sentence reversed_sentence = " ".join(reversed_words) return reversed_sentence
def str(name): s=name.split() r=map(lambda t:t[::-1],s) return ''.join(r) text=input("text: ") print(str(text))
Submitting answers is currently unavailable.
1- The system randomly selects a number between 1 and 100 2- The user tries to guess the selected number 3- After each user guess, if the number entered is correct, the program will end. Otherwise the schedule ...
Write a function that receives some and checks whether the amount received is the email. If the email was True, otherwise the False return the email should contain @ before @ should be a phrase as a work name ...
Write a function that returns the number of a character in a string. To this question you should not use ready -to -use functions ("hooshang", "O") #2
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.