The value of "addressee" is capitalized and assigned to "cap_addressee.".Next, we append a comma and a space to salut in preparation for the addressee. Whatever the outcome of the if.else statements, the value of "cap_greeting" is added onto the value of "salut," using class object's append method.Next, if "greeting" does not equate to the string "Hello," then, using function caps(), we capitalize the value of "greeting" and assign it to "cap_greeting." Otherwise, "cap_greeting" is assigned the value of "greeting." If this seems tautological, it is, but it is also illustrative of conditional statements in Python.The code creates an instance of the Felicitations class and call it "salut," which allows access to the parts of Felicitations as they exist in salut.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |