-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
maryletteroa
committed
Aug 22, 2019
1 parent
59802aa
commit 0d05e79
Showing
8 changed files
with
495 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Write a program that accepts 3 integers and separate these into odd and even numbers. | ||
# Duplicates are permited in the input but not in the output. | ||
|
||
# Example | ||
|
||
# >>> Enter first number: 3567 | ||
# >>> Enter second number: 789 | ||
# >>> Enter third number: 1234 | ||
# odd: {789, 3567} | ||
# even: {1234} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Write a program that accepts 3 integers and separate these into odd and even numbers. | ||
# Duplicates are permited in the input but not in the output. | ||
|
||
# Example | ||
|
||
# >>> Enter first number: 3567 | ||
# >>> Enter second number: 789 | ||
# >>> Enter third number: 1234 | ||
# odd: {789, 3567} | ||
# even: {1234} | ||
|
||
|
||
odd = [] | ||
even = [] | ||
|
||
num1 = int(input("Enter first number: ")) | ||
|
||
if num1 % 2 == 1: | ||
odd.append(num1) | ||
else: even.append(num1) | ||
|
||
num2 = int(input("Enter second number: ")) | ||
|
||
if num2 % 2 == 1: | ||
odd.append(num2) | ||
else: even.append(num2) | ||
|
||
|
||
num3 = int(input("Enter third number: ")) | ||
|
||
if num3 % 2 == 1: | ||
odd.append(num3) | ||
else: even.append(num3) | ||
|
||
|
||
|
||
print(f"odd: {set(odd)}") | ||
print(f"even: {set(even)}") |
Oops, something went wrong.