Demo entry 6313241

strDraft

   

Submitted by anonymous on Oct 25, 2016 at 23:28
Language: Python 3. Code size: 788 Bytes.

#Project:   String Methods
#Name:      Lena Echeverria
#Date:      10/24/16
#Description:   Two examples of different string methods

#define main
def main():
    #define the string variable
    strA="Red Pandas are my favorite"
    #print the variable before changing anything
    print(strA)
    #print the changed variable. Changed "pandas" to "vines"
    print(strA.replace("Pandas","Vines"))
main()

#to separate the two examples the user has to press enter before the
#second program executes
input()

#def mainb
def mainb():
    #start with same sentence
    strB="Red Pandas are my favorite"
    #sentence is the same as the first one so don't print again
    #I think it's funnier to have mainb isolated :)
    print(strB.upper(),"!!")
mainb()

    

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).