Given the string matric_no = "ND/20/COM/FT/500". Write a python range statement to display: i. Level ii. Year of study iii. Cour | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Given the string matric_no = "ND/20/COM/FT/500". Write a python range statement to display: i. Level ii. Year of study iii. Cour

I need a clue to solving this please

4th May 2021, 6:45 PM
HORLATECH
HORLATECH - avatar
4 Answers
+ 1
if I understand correctly, that string contains all the informaion you need but you have to process it to retrieve the information you want. so to achieve this you would need to cut the string at each '/' info = matric_no.split("/") now all of the information is present in a list and you can access each element with their index print(info[0]) print(info[3]) I hope this helps :)
4th May 2021, 6:52 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
level,yos,cos,mop,id = matric_no.split("/")
4th May 2021, 7:45 PM
Oma Falk
Oma Falk - avatar
0
iii. Course of study iv. Mode of programme v. Student I.d
4th May 2021, 6:46 PM
HORLATECH
HORLATECH - avatar
0
Apollo-Roboto thanks it helps. But the . split ("/") function didn't execute.. I only have a split result without (/)..
4th May 2021, 8:19 PM
HORLATECH
HORLATECH - avatar