Practise the different ways of indexing and slicing a string.
Two values are read from the standard input, one per line, in this order:
s — a string of at least four characterscourse_code — a course code such as 24t2cs1002, where the first two characters are the year, the third and fourth are the term (t2 means term 2) and the rest are the course idAssign the following variables:
output1 (str) — the third character of soutput2 (str) — the fourth last character of soutput3 (str) — the first 3 characters of soutput4 (str) — every second character of s, starting from the firstoutput5 (str) — the last 3 characters of soutput6 (str) — s reversedcourse_term (int) — the term number taken from course_codecourse_year (int) — the two digit year taken from course_codeUse indexing and slicing only; do not use a loop.
The input is read for you. Assign the answers to output1, output2, output3, output4, output5, output6, course_term, course_year.
You do not need to print anything — the values you assign to those names are what gets checked, in that order.
Input
hello pyhton
24t2cs1002
Output
'l'
'h'
'hel'
'hlopho'
'ton'
'nothyp olleh'
2
24