มีตัวแปร text
เก็บสตริงอยู่แล้ว ถ้าใน text
มี Python หรือ python ปรากฏอยู่ให้แสดง Yes ไม่เช่นนั้นแสดง No
text= "Python Programming"
if "Python" in text or "python" in text:
print("Yes")
else:
print("No")
t = ["OkPythonOk", "Python is ok", "Ok Python", "JythonJa", "pyton"]
for v in t:
Ex().has_equal_output(pre_code = "text='"+v+"'", incorrect_msg = "ผิด เช่น text = '" + v + "'")
v = v.lower()
Ex().has_equal_output(pre_code = "text='"+v+"'", incorrect_msg = "ผิด เช่น text = '" + v + "'")
มีตัวแปร month
เก็บสตริงอยู่แล้ว ถ้า month
เก็บชื่อเดือน ให้แสดง Yes ไม่เช่นนั้นก็แสดง No ชื่อเดือนมีดังนี้ January, February, March, April, May, June, July, August, September, October, November, December
month = "October"
t = ["January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December"]
if month in t:
print("Yes")
else:
print("No")
t = ["Meenakom", "January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December" ]
for v in t:
Ex().has_equal_output(pre_code = "month='"+v+"'", incorrect_msg = "ผิด เช่น month = '" + v + "'")
v = v.lower()
Ex().has_equal_output(pre_code = "month='"+v+"'", incorrect_msg = "ผิด เช่น month = '" + v + "'")