PEP 8 and naming
You named your variables according to PEP 8 and also gave them reasonable names, with some exceptions:
list. It overrides a built-in type and does not convey what it contains. Consider renaming it
WEEKDAYS as it represents a global constant.
give_day actually reads the current day from the user, so
current_day would be more appropriate
- ... and so would be
current_day_index instead of
Also note that PEP 8 wants you to put a space after a comma in e.g. list definitions.
You never validate the input of the user. If they enter an invalid day, the program will terminate with a
Know your requirements
Your title only mentions returning the next day, but the program also calculates the previous day. Is this necessary?
Currently your code only works as an isolated script. There is no reusability.
Consider putting the code that returns the next item of an arbitrary list into a function
Putting it together
#! /usr/bin/env python3
from os import linesep
from typing import Any
WEEKDAYS = [
def neighbors(item: Any, items: list[Any]) -> tuple[Any, Any]:
"""Return the predecessor and successor entry
for the item of the given list.
items[(index := items.index(item)) - 1],
items[(index + 1) % len(items)]
def main() -> None:
"""Run main program."""
current_day = input('Enter the day : ')
previous_day, next_day = neighbors(current_day, WEEKDAYS)
print('Invalid weekday:', current_day)
print(previous_day, next_day, sep=linesep)
if __name__ == '__main__':