+ 1
How I remove whitespace from output.....
8 Respostas
+ 7
You also might want to make your code more DRY (Don't Repeat Yourself). Here's one example.
months = {
"January": "1",
"February": "2",
"March": "3",
"April": "4",
"May": "5",
"June": "6",
"July": "7",
"August": "8",
"September": "9",
"October": "10",
"November": "11",
"December": "12"
}
date = input()
year = date[len(date)-4:]
if "," in date:
month = months.get(date[:date.find(" ")])
day = date[date.find(" ")+1:date.find(",")]
else:
date = date.split("/")
month = date[0]
day = date[1]
print(f"{day}/{month}/{year}")
+ 3
You'll need to correct the spelling of the months too 😉
+ 2
Sid , please make sample for us with input / output data, so that we don't have to guess. Also give us a clear task description. Thanks!
+ 2
Here is the code:
https://code.sololearn.com/c0da1iUwi2xZ/#py
+ 2
Remove the commas from your print statements. They're adding whitespace. Use "+" instead
+ 2
Just write end=""
This might work
+ 1
print(a, b, c, sep = "")
https://code.sololearn.com/cTiay1gR16w3/?ref=app
0
Plz.. follow the above link..
Which is mentioned in question....