Find the max odd number from 10 inputs [closed]
up vote
-3
down vote
favorite
Hi every one this is my code which is perfect but in print "All are even number" is not working perfectly >>> it is print 10 times when all are even
code is here :-
a = int(input('Enter a value: '))
b = int(input('Enter a value: '))
c = int(input('Enter a value: '))
d = int(input('Enter a value: '))
e = int(input('Enter a value: '))
f = int(input('Enter a value: '))
g = int(input('Enter a value: '))
h = int(input('Enter a value: '))
i = int(input('Enter a value: '))
j = int(input('Enter a value: '))
list1 = [a, b, c, d, e, f, g, h, i, j]
list2 = # used to sort the ODD values into
list3 = (a+b+c+d+e+f+g+h+i+j)
if (list3 % 2 == 0):
for even in list1:
if (even % 2 == 0):
print('All declared variables have even values')
else:
for odd in list1:
if (odd % 2 == 1):
list2.append(odd)
odd = max(list2)
print ('The largest ODD value is ', odd)
python
closed as off-topic by Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ Dec 3 at 17:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-3
down vote
favorite
Hi every one this is my code which is perfect but in print "All are even number" is not working perfectly >>> it is print 10 times when all are even
code is here :-
a = int(input('Enter a value: '))
b = int(input('Enter a value: '))
c = int(input('Enter a value: '))
d = int(input('Enter a value: '))
e = int(input('Enter a value: '))
f = int(input('Enter a value: '))
g = int(input('Enter a value: '))
h = int(input('Enter a value: '))
i = int(input('Enter a value: '))
j = int(input('Enter a value: '))
list1 = [a, b, c, d, e, f, g, h, i, j]
list2 = # used to sort the ODD values into
list3 = (a+b+c+d+e+f+g+h+i+j)
if (list3 % 2 == 0):
for even in list1:
if (even % 2 == 0):
print('All declared variables have even values')
else:
for odd in list1:
if (odd % 2 == 1):
list2.append(odd)
odd = max(list2)
print ('The largest ODD value is ', odd)
python
closed as off-topic by Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ Dec 3 at 17:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
6
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
Hi every one this is my code which is perfect but in print "All are even number" is not working perfectly >>> it is print 10 times when all are even
code is here :-
a = int(input('Enter a value: '))
b = int(input('Enter a value: '))
c = int(input('Enter a value: '))
d = int(input('Enter a value: '))
e = int(input('Enter a value: '))
f = int(input('Enter a value: '))
g = int(input('Enter a value: '))
h = int(input('Enter a value: '))
i = int(input('Enter a value: '))
j = int(input('Enter a value: '))
list1 = [a, b, c, d, e, f, g, h, i, j]
list2 = # used to sort the ODD values into
list3 = (a+b+c+d+e+f+g+h+i+j)
if (list3 % 2 == 0):
for even in list1:
if (even % 2 == 0):
print('All declared variables have even values')
else:
for odd in list1:
if (odd % 2 == 1):
list2.append(odd)
odd = max(list2)
print ('The largest ODD value is ', odd)
python
Hi every one this is my code which is perfect but in print "All are even number" is not working perfectly >>> it is print 10 times when all are even
code is here :-
a = int(input('Enter a value: '))
b = int(input('Enter a value: '))
c = int(input('Enter a value: '))
d = int(input('Enter a value: '))
e = int(input('Enter a value: '))
f = int(input('Enter a value: '))
g = int(input('Enter a value: '))
h = int(input('Enter a value: '))
i = int(input('Enter a value: '))
j = int(input('Enter a value: '))
list1 = [a, b, c, d, e, f, g, h, i, j]
list2 = # used to sort the ODD values into
list3 = (a+b+c+d+e+f+g+h+i+j)
if (list3 % 2 == 0):
for even in list1:
if (even % 2 == 0):
print('All declared variables have even values')
else:
for odd in list1:
if (odd % 2 == 1):
list2.append(odd)
odd = max(list2)
print ('The largest ODD value is ', odd)
python
python
edited Dec 3 at 15:51
Mathias Ettinger
23.1k33178
23.1k33178
asked Dec 3 at 15:48
PRANAV THAKKAR
1
1
closed as off-topic by Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ Dec 3 at 17:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ Dec 3 at 17:39
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Mathias Ettinger, Graipher, 200_success, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
6
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49
add a comment |
6
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49
6
6
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
6
It can't be "perfect" if it's "not working perfectly". In the latter case, the bug needs to be fixed before it's ready for review.
– Toby Speight
Dec 3 at 15:49