Question
1. The variable word references the string ‘winter’. Use for loops to create new strings with various text effects as follows.
Variable long_word becomes ‘wwwiiinnnttteeerrr’
Variable crossed_word becomes ‘XwXiXnXtXeXr’
word = 'winter'
long_word = ''
# write the for loop that traverses word to create
# long_word with value 'wwwiiinnnttteeerrr'
crossed_word = ''
# write the for loop that traverses word to create
# crossed_word with value 'XwXiXnXtXeXr'
print(long_word)
print(crossed_word)
word = 'winter' long_word = '' # write the for loop that traverses word to create # long_word with value 'wwwiiinnnttteeerrr' for x in word: long_word += (x*3) crossed_word = '' # write the for loop that traverses word to create # crossed_word with value 'XwXiXnXtXeXr' for x in word: crossed_word += ('X'+x) print(long_word) print(crossed_word)
Get Answers For Free
Most questions answered within 1 hours.