It is displayed as an even number even though it is odd numbers odd.

Asked 1 years ago, Updated 1 years ago, 252 views

"When I entered ""7"" as shown in the image, 7 was made into an even number even though it was not an even number."Please tell me the solution.

I would appreciate it if you could tell me in detail what is different and what should be corrected.

image

python

2023-03-06 12:12

2 Answers

Is the variable n really an integer?
Isn't n/2 like 3.5?


2023-03-06 13:35

It's a programming error.
Perhaps the program is not designed to be what you intend.

The if statement does not determine any s containing the entered number.

The n you are looking at is the number of elements in the a list, so it is 8 and even.


2023-03-06 15:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.