Python Forum
function help (totaly beginner)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function help (totaly beginner)
#6
Why do you need 'n'?

How to iterate over a string?
for letter in word: # here the word is whatever word you like.
    print(letter) # letter is holding the next letter of the word on each iteration. 
create a variable which will contain the final result and put a '*' in it during the initialization. On each iteration add a letter to it followed by a '*'. and you get the final result as requested. All this inside the function.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
function help (totaly beginner) - by thanikos - Dec-07-2017, 12:32 PM
RE: function help (totaly beginner) - by thanikos - Dec-07-2017, 12:44 PM
RE: function help (totaly beginner) - by wavic - Dec-07-2017, 12:50 PM
RE: function help (totaly beginner) - by thanikos - Dec-07-2017, 12:56 PM
RE: function help (totaly beginner) - by wavic - Dec-07-2017, 01:10 PM
RE: function help (totaly beginner) - by gruntfutuk - Dec-07-2017, 03:07 PM
RE: function help (totaly beginner) - by thanikos - Dec-10-2017, 11:25 PM
RE: function help (totaly beginner) - by wavic - Dec-11-2017, 02:02 AM
RE: function help (totaly beginner) - by thanikos - Dec-11-2017, 08:55 AM
RE: function help (totaly beginner) - by Item97 - Dec-11-2017, 08:57 AM
RE: function help (totaly beginner) - by wavic - Dec-11-2017, 09:54 PM
RE: function help (totaly beginner) - by thanikos - Dec-12-2017, 07:12 PM
RE: function help (totaly beginner) - by wavic - Dec-12-2017, 08:48 PM
RE: function help (totaly beginner) - by thanikos - Dec-13-2017, 08:32 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020