Untitled

 avatar
unknown
python
9 months ago
1.2 kB
1
Indexable
#taking all the inputs from user
sNumber = input("Enter student number: ")
fName = input("Enter first name: ")
lName = input("Enter last name: ")
cCode = input("Enter course code: ")
cName = input("Enter course name: ")
cpOne = input("Enter 100-level credit point: ")
cpTwo = input("Enter 200-level credit point: ")
cpThree = input("Enter 300-level credit point: ")
displayOption = input("Enter display option A/B: ")


#displaying option A
if displayOption.upper() == "A":
    print()
    print("(")
    print('''  "courseCode" -> "{0}".'''.format(cCode))
    print('''  "courseName" -> "{0}".'''.format(cName))
    print('''  "cp" -> [{0}, {1}, {2}].'''.format(cpOne, cpTwo, cpThree))
    print(")")

#displaying option B
elif displayOption.upper() == "B":
    print()
    print("(")
    print('''  "studentNumber" -> "{0}".'''.format(sNumber))
    print('''  "firstName" -> "{0}".'''.format(fName))
    print('''  "lastName" -> "{0}".'''.format(lName))
    print('''  "courseCode" -> "{0}".'''.format(cCode))
    print(")")
    
#displaying option other than A/B
else:
    print()
    print("Only support options A and B.")
    print("Good bye!")
Editor is loading...
Leave a Comment