Frequently Asked Python Program 21:How To Reverse Words in a String

Frequently Asked Python Program 21:How To Reverse Words in a String

SDET- QA

4 года назад

71,373 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Kevin Vélez
Kevin Vélez - 11.10.2023 02:08

word = "hello world"
word = word.split(" ")
word = word[::-1]
print(word)

word = "hello world"
word = word.split(" ")
word = word[-1::-1]
print(word)

Ответить
Manav Sadiwala
Manav Sadiwala - 20.02.2023 16:54

How to skip last two words in sentence?

My input string is: Hi there. My name is Kalp. This is my lucky day. I like coding so much. This is it.

Expected output is: Hi there. name My is Kalp. my is This lucky day. coding like I so much. This is it.

Ответить
Zenzuchi
Zenzuchi - 20.12.2022 17:01

Thankssss

Ответить
VISION STATUS
VISION STATUS - 25.10.2022 20:44

Str= input()
L=[]
For i in Str.split():
L.append(str[i][::-1])
Print("".join(L))

Ответить
VISION STATUS
VISION STATUS - 25.10.2022 20:43

Str= input()
A = str.split()
Print ( reversed(A))

Ответить
Thug Shaker
Thug Shaker - 28.09.2022 20:50

What does [-1 : : -1] means please explain...

Ответить
Keyhan Piran
Keyhan Piran - 01.02.2022 07:27

Very helpful!

Ответить
Shreeya Kulkarni
Shreeya Kulkarni - 17.01.2022 07:28

Sir can we use print formatting ?

Ответить
Shivani bhardwaj
Shivani bhardwaj - 03.10.2021 15:29

thanku i just got out from an interview yesterday over the same question

Ответить
P4 | Mahi Op
P4 | Mahi Op - 19.08.2021 06:16

sdet should be printed as ted ..?

Ответить
arpit mathur
arpit mathur - 31.07.2021 18:36

please explain without in built functions

Ответить
Srinivasa Reddy Challa
Srinivasa Reddy Challa - 01.06.2021 16:21

Explain without using inbuilt functions

Ответить
Abdullah Omar
Abdullah Omar - 03.02.2021 11:06

why you didn't use words.reverse() ?

Ответить
SIVA PRIYA
SIVA PRIYA - 02.01.2021 11:13

thank you so much how to do in recursive function

Ответить
russianrightnow
russianrightnow - 04.12.2020 15:47

Hello! Thank you so much for your help! I've been searching for this explanation

Ответить
Andres Fox
Andres Fox - 23.07.2020 22:04

Nice.

Ответить
Kv Nagendra
Kv Nagendra - 04.11.2019 14:10

Tq bro

Ответить