exam_year=2019
candidate_type_input= input(" What Type Of Candidate Is This Student.\n 1.Private Candidate(ENTER 1 FOR THIS)\n 2.School Candidate(ENTER 2 FOR THIS\n Enter A Choice Please: ) ")
while candidate_type_input != 1or 2:
candidate_type_input=
int(input(" Invalid Choice
Selected.\n Check Instructions
Above And Try Again: "))
if candidate_type_input == 1:
exam_type= 'WASSCE FOR PRIVATE CANDIDATES'+ str(exam_year)
elif candidate_type_input == 2:
exam_type= 'WASSCE FOR SCHOOL CANDIDATES'+str(exam_year)
Asked
Active
Viewed 19 times
0

chepner
- 497,756
- 71
- 530
- 681

River Uzoma
- 15
- 6
-
1Aside from the misconstructed comparison, `candidate_type_input` is a `str` value, and so will never be equal to an `int` value like `1` or `2`. You need to compare to a string, or convert the input to an `int` first. – chepner Sep 22 '21 at 17:16
-
Thank you. I have corrected that and put (1 or 2) in brackets. It is now only working for 1 and not 2. – River Uzoma Sep 22 '21 at 17:23
-
Yes, that's the part the linked duplicate fixes. You can't just put `1 or 2` in parentheses; (in)equality testing doesn't work that way. – chepner Sep 22 '21 at 17:23
-
Okay. So what do you suggest I do. Separate it and nest one inside another? – River Uzoma Sep 22 '21 at 17:27
-
Have you read the duplicate question and the accepted answer? – chepner Sep 22 '21 at 17:33
-
Read the duplicate question? Not sure i quite understand – River Uzoma Sep 22 '21 at 17:36
-
Look at the blue box above your question. There are links to two questions that provide the answers you are looking for. – chepner Sep 22 '21 at 17:37