{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise 2\n", "\n", "string, input, print, defining a good function\n", "basic string manipulation, python3 string utilities\n", "\n", "บาง function หรือ method ที่ต้องใช้ในการแก้ปัญหาโจทย์เหล่านี้อาจจะยังไม่ได้เรียนมา ให้ลองหาใน documentation ของ python \n", "\n", "https://docs.python.org/3/library/stdtypes.html#string-methods\n", "\n", "อาจจะต้องใช้ methods เหล่านี้\n", "~~~~\n", " 'capitalize',\n", " 'count',\n", " 'endswith',\n", " 'find',\n", " 'index',\n", " 'isalnum',\n", " 'isalpha',\n", " 'isdecimal',\n", " 'isdigit',\n", " 'islower',\n", " 'isnumeric',\n", " 'isspace',\n", " 'isupper',\n", " 'lower',\n", " 'replace',\n", " 'rfind',\n", " 'rindex',\n", " 'rjust',\n", " 'rstrip',\n", " 'startswith',\n", " 'strip',\n", " 'swapcase',\n", " 'upper'\n", "~~~~" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# ข้อ 1 \n", "เมื่อปี 2007 ที่ผ่านมานักร้องสาว Rihanna จากเกาะ Barbados ได้ร้องเพลงสุดฮิตที่เกี่ยวข้องกับสภาพภูมิอากาศของเมืองไทยในขณะนี้เป็นยิ่งนัก \n", "ท่อนฮุคที่ดังติดหูคือ\n", "\n", "> You can stand under my umbrella\n", ">\n", "> You can stand under my umbrella, ella, ella, eh, eh, eh\n", ">\n", "> Under my umbrella, ella, ella, eh, eh, eh\n", ">\n", "> Under my umbrella, ella, ella, eh, eh, eh\n", ">\n", "> Under my umbrella, ella, ella, eh, eh, eh, eh, eh, eh\n", "\n", "จงเขียนโปรแกรม Python ที่ print เนื้อเพลง Umbrella ส่วนที่คัดลอกไว้ข้างบนนี้โดย reuse function ให้ได้มากที่สุด \n", "\n", "ข้อนี้ไม่ต้องเขียน Docstring " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# ข้อ 2\n", "เว็บไซต์เขียนด้วยภาษา HTML เต็มไปด้วย HTML tag เพื่อ mark ส่วนต่างๆ ของเว็บไซต์ของออกมาเป็นในลักษณะที่เราต้องการ\n", "~~~~\n", "\n", "
\n", " \"Hello, World\"\n", " \n", "\n", "~~~~\n", "เพื่อให้ถูกต้องตาม Syntax ของภาษา HTML เมื่อเราเปิดแท็ก `