Difference between revisions of "Python Problems and Solutions"

From rbachwiki
Jump to navigation Jump to search
(Created page with "<nowiki> st = 'Print only the words that start with s in this sentence' for word in (st.split()): if word[0]== 's': print(word) </nowiki>")
 
Line 1: Line 1:
<nowiki>
<pre>
st = 'Print only the words that start with s in this sentence'
st = 'Print only the words that start with s in this sentence'
for word in (st.split()):
for word in (st.split()):
     if word[0]== 's':
     if word[0]== 's':
     print(word)
     print(word)
</nowiki>
</pre>

Revision as of 02:36, 29 January 2019

st = 'Print only the words that start with s in this sentence'
for word in (st.split()):
    if word[0]== 's':
     print(word)