Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two questions
#3
(Mar-28-2018, 09:15 PM)Larz60+ Wrote: 1.
import string
keywords = string.ascii_lowercase

def rotate(s, n):
    return s[n:] + s[:n]
example:
Output:
>>> x = string.ascii_lowercase >>> rotate(x, 3) 'defghijklmnopqrstuvwxyzabc' >>> >>> rotate(x, -3) 'xyzabcdefghijklmnopqrstuvw'

Sorry but i don't understand how to use this :( I'm begginer so i really don't know what to do with your code.
Reply


Messages In This Thread
Two questions - by jure98 - Mar-28-2018, 08:45 PM
RE: Two questions - by Larz60+ - Mar-28-2018, 09:15 PM
RE: Two questions - by jure98 - Mar-29-2018, 08:40 AM
RE: Two questions - by Larz60+ - Mar-29-2018, 09:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Discord bot that asks questions and based on response answers or asks more questions absinthium 1 44,154 Nov-25-2017, 06:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

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