« Back to the Python Forum

mm/dd/yyyy prompt with 3 input fields separated by forward slashes either static or printed after input on same line

Posted by Raven Scott

posted
updated

Forum: Python Group

I am trying to create a prompt that
is either separated by hard slashes or slashes appear after specified
input range, all on a single line.
i want: M/D/Y: input/input/input
not: M:
D:
Y:
example:

Enter the date M/D/Y: '12'/'12'/'1234'

Ideal: the slash appears after
populating the specified range...(mm) if users enters two integers,
backslash appears(dd) if users enters two integers, backslash
appears(yyyy) user completes the range

or: the slashes are static but the input fields between are mutable, and cursor skips slashes.

so far, this seems to work, with the remaining issues being keeping the output on the same line rather than creating a newline.

this
is what I've done so far, which outputs a slash after input, but the
"allowable input range" (excuse my natty lang) isn't set, and it prints
on a newline instead of sameline.
(is sameline even a thing?)

m = 0
d = 0
y = 0
m = int(input(f'M/D/Y:'),'/', d = int(input('/'), y = int(input('/'))))

backslash appears(dd) if users enters two integers, backslash
appears(yyyy) user completes the range

or: the slashes are static but the input fields between are mutable, and cursor skips slashes.

so far, this seems to work, with the remaining issues being keeping the output on the same line rather than creating a newline.

m = 0
d = 0
y = 0

m = int(input(f'M/D/Y:'),'/', d = int(input('/'), y = int(input('/'))))


Report Topic

0 Replies