samedi 16 septembre 2017

how to return values made in a for loop

so I have this code:

import random as r
def reverse(string):
    stri = list()
    for i in range(len(string)):
        stri.insert(0, string[i])
    for j in range(len(stri)):
        print(stri[j], end="") 

and I want to return the values instead of printing them.
how do I make it to where the function returns the values and doesnt print them?




Aucun commentaire:

Enregistrer un commentaire