1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ドドドドド初心者がPythonでTodoリスト作ってみた

Last updated at Posted at 2024-05-25

みなさん、はじめまして。
今回はドドドドド初心者がpythonで、Todoリストを作ってみました。
こちらです!

Todo = ['day', 'time', 'do', 'delete', 'end']
list = []
while not Todo[4] == "2":
    Todo[0] = input("日付を入力してください\n")
    Todo[1] = input("時間を入力してください\n")
    Todo[2] = input("やることを入力してください\n")
    print(f'{Todo[0]}   {Todo[1]}\n'
          f'{Todo[2]}')
    list.append(f'{Todo[0]} {Todo[1]}\n{Todo[2]}\n')
    while not Todo[4] == 2:
        Todo[4] = input('続けますか?(続ける場合は1を入力、終了の場合は2を入力してください。\n'
                        'また、修正したい場合は、3を入力してください)')
        if Todo[4] == '1':
            break
        if Todo[4] == '2':
            break
        elif Todo[4] == '3':
            Todo[3] = int(input('修正したい項目を1~3で入力してください。\n'
                    '1:日付\n'
                    '2:時間\n'
                    '3:やること\n'))
            while Todo[3] == 1 or 2 or 3:
                if Todo[3] == 1:
                    Todo[0] = input('日付を入力してください。')
                    break
                elif Todo[3] == 2:
                    Todo[1] = input("時間を入力してください\n")
                    break
                elif Todo[3] == 3:
                    Todo[2] = input("やることを入力してください\n")
                    break
                else:
                    print('不適切な値です。もう一度選択してください')
                    break
            list.pop(-1)
            list.append(f'{Todo[0]} {Todo[1]}\n{Todo[2]}\n')
            pass
        continue
    if Todo[4] == '1':
        continue
    if Todo[4] == '2':
        for todolist in list:
            print(todolist)
        break

もっと知識があれば簡略化できると思うのですが、まだ知識全然ないので有能な兄貴姉貴、アドバイスお願いします!!

1
1
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?