Exercise 4

  1. Write a Python script to extract a course number, code, and name from the following text using regular expressions.

CoursesData = """101 COM Computers 205 MAT Mathematics 189 ENG English"""

  1. Write a Python script to extract each course’s details in a tuple form from the following text using regular expressions. In addition, use regular expressions to retrieve string values in the CoursesData and then retrieve numerical values in CoursesData.
  1. Write a Python script to extract digits of size 4 and digits of size 2 to 4 using regular expressions.

CoursesData = """10 COM Computers 205 MAT Mathematics 1899 ENG English"""