-
Notifications
You must be signed in to change notification settings - Fork 14
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
1 parent
2c4fe54
commit b8b9a93
Showing
4 changed files
with
22 additions
and
5 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 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 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 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,17 @@ | ||
def DashInsertII(num): | ||
result = "" | ||
for i in str(num): | ||
if (len(result)==0): | ||
result += i | ||
continue | ||
if int(i)%2 == 1 and int(result[-1])%2==1: | ||
result += "-" + i | ||
elif int(i) != 0 and int(i)%2 == 0 and int(result[-1]) != 0 and int(result[-1])%2 == 0: | ||
result += "*" + i | ||
else: | ||
result += i | ||
return result | ||
|
||
# keep this function call here | ||
# to see how to enter arguments in Python scroll down | ||
print DashInsertII(raw_input()) |