Programming Fundamentals
This is my block and it's all about the code
วันอาทิตย์ที่ 4 ตุลาคม พ.ศ. 2558
Lab5-My find
def my_find(string,alphabet):
i = 0
posAlpha = 0
print('position of',alphabet,'in',string,'is')
while(i<len(string)):
if(string[i] == alphabet):
print(i)
i+=1
def setup():
S = 'Straightforward'
alp = 'r'
my_find(S,alp)
setup()
Result
position of r in Straightforward is 2 10 13
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น