forked from somat/python-course
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Agung Pamuji
committed
Oct 20, 2011
1 parent
1732cca
commit 0c138eb
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
#!/usr/bin/env python | |||
print "=======================================================================" | |||
print "1. str.capitalize():" | |||
str = "inovasi tiada henti"; | |||
print "str.capitalize():", str.capitalize() | |||
print "=======================================================================" | |||
print "2. str.center(width[width[,fillchar]):" | |||
str = "nggak ada tulisan berarti nggak kerja"; | |||
print "str.center(50):", str.center(50) | |||
print "=======================================================================" | |||
print "3. str.count(sub[,start[,end]]):" | |||
str = "tututlah ilmu sampai ke negeri cina"; | |||
sub = "a"; | |||
print "str.count(sub, 4, 34):", str.count(sub, 4, 34) | |||
sub = "negeri"; | |||
print "str.count(sub) : ", str.count(sub) | |||
print "=======================================================================" | |||
print "4. str.find(sub[, start[, end]]):" | |||
str = "manusia baik, manusia yang bermanfaat bagi manusia lainnya"; | |||
sub = "baik"; | |||
print "str,find(sub, 1, 30):", str.find(sub, 1, 30) | |||
print "=======================================================================" | |||
print "5. str.isspace():" | |||
str = " "; | |||
print "str.isspace():", str.isspace(); | |||
str = "metode ini memeriksa apakah string ini hanya terdiri spasi saja?"; | |||
print "str.isspace():", str.isspace(); | |||
print "=======================================================================" |