Python Todoリスト

class TodoList:
def init(self):
self.tasks = []

def add_task(self, task):
    self.tasks.append(task)

def remove_task(self, task):
    if task in self.tasks:
        self.tasks.remove(task)
    else:
        print("タスクが見つかりません。")

def list_tasks(self):
    if not self.tasks:
        print("ToDoリストは空です。")
    else:
        print("ToDoリスト:")
        for idx, task in enumerate(self.tasks, start=1):
            print(f"{idx}. {task}")

def main():
todo_list = TodoList()
while True:
print(“\n操作を選択してください:”)
print(“1. タスクを追加”)
print(“2. タスクを削除”)
print(“3. タスク一覧を表示”)
print(“4. 終了”)
choice = input(“選択: “)

    if choice == '1':
        task = input("タスクを入力してください: ")
        todo_list.add_task(task)
        print("タスクが追加されました。")

    elif choice == '2':
        task_idx = int(input("削除するタスクの番号を入力してください: "))
        if 1 <= task_idx <= len(todo_list.tasks):
            task_to_remove = todo_list.tasks[task_idx - 1]
            todo_list.remove_task(task_to_remove)
            print("タスクが削除されました。")
        else:
            print("無効な番号です。")

    elif choice == '3':
        todo_list.list_tasks()

    elif choice == '4':
        print("プログラムを終了します。")
        break

    else:
        print("無効な選択です。")

if name == “main“:
main()

投稿者: chosuke

趣味はゲームやアニメや漫画などです

「Python Todoリスト」への23件のフィードバック

  1. If I am being honest this is the kind of site I quietly hope my own work will someday resemble, and a stop at shadowglowcorner extended that aspirational feeling, finding work that models what I want to produce is part of why I read carefully and this site has been performing that modelling function for me lately consistently.

  2. Now planning a longer reading session for the archives, and a stop at modernbuycorner confirmed the archives are worth that longer commitment, sites with archives I want to read deliberately rather than just sample are rare and this one has clearly earned that level of interest based on the consistency of what I have already read.

  3. Worth flagging that this approach to the topic is fresh without being contrarian, and a stop at frostgrovecrafts extended the same fresh angle, finding original perspective on familiar subjects is rare and this site has clearly developed its own way of seeing rather than echoing the dominant takes from elsewhere consistently.

  4. Now feeling the small relief of finding writing that does not condescend, and a stop at goldenpinecollective extended that respect for readers, content that treats its audience as capable adults rather than as people to be managed produces a different reading experience and this site has clearly chosen the respectful approach across all pieces.

  5. If the topic interests you at all this is a place to spend time, and a look at twilightfernstore reinforced that recommendation, the broader question of where to invest topical reading time is one this site answers convincingly through the consistent quality across multiple pieces I have sampled during the current reading session today.

  6. Now understanding why someone recommended this site to me a while back, and a stop at fasttrendhub explained the recommendation, sometimes recommendations make sense only after experience and this site has finally clicked into place as the kind of resource I now understand was being recommended for sound editorial reasons by my friend.

  7. Walked away with a clearer head than I had before reading this, and a quick visit to cleverdealstation only sharpened that, the writing has a way of cutting through the noise that surrounds most topics online which is something I will definitely remember the next time I am searching for an answer to anything.

  8. My professional context would benefit from having this kind of resource available, and a look at goldenharvestlane extended the professional applicability, the rare site that contributes meaningfully to professional work rather than just personal interest is content with multiplied value and this one is providing that professional utility consistently across multiple pieces.

  9. Liked that the post resisted a sales pitch ending, and a stop at neonbuycenter maintained the no pitch approach, content that ends without trying to convert me into a customer or subscriber is content that has confidence in its own value and this site is clearly playing the long game on reader trust.

  10. Following a few of the internal links revealed more posts of similar quality, and a stop at urbanharborcollective added more to that growing pile, sites where internal links lead to more good content rather than to more of the same recycled material are sites with depth and this one has clearly built that depth carefully.

  11. Well done, the writing is professional without being stiff, and the topic is treated with care, and a look at urbancartarena reflected that approach, the kind of site I would point a colleague to if they asked for a reliable starting point on this topic in the future without any hesitation at all.

  12. Now feeling slightly more optimistic about the state of independent writing online, and a stop at swifttrendhub extended that quiet optimism, sites like this one are the reason I have not given up on the open web entirely and finding them occasionally renews the case for paying attention to non algorithmic content sources today.

  13. Decided this was the best thing I had read all morning, and a stop at silverhorizonstore kept that ranking intact, ranking my reading is something I do mentally throughout the day and the top rank is competitive and not easily won but this site won it without needing to overstate its claims for that.

  14. Closed it feeling slightly more competent in the topic than I started, and a stop at freshcartcorner reinforced that competence boost, real learning is rare in casual online reading but it does happen sometimes and this site managed to make it happen for me today which is genuinely worth pausing to acknowledge.

  15. Now recognising that the post handled the topic with appropriate technical precision without becoming dry, and a stop at premiumpickzone continued that balance, technical precision and readability are often in tension and this site has clearly figured out how to maintain both at once which is one of the harder editorial achievements in the form.

  16. Worth recognising that this site does not chase the daily news cycle, and a stop at dreamwovenbazaar confirmed the longer publication arc, sites that resist the pressure to comment on every passing event are sites with genuine editorial discipline and this one has clearly chosen depth over volume which I respect deeply.

  17. Closed three other tabs to focus on this one and never opened them again, and a stop at epiccartcenter similarly held attention exclusively, content that crowds out other reading from working memory is content with real density and this site has demonstrated that density across multiple pages I have visited so far this morning.

  18. Will share this on a forum I am part of where it will be appreciated by others working in the same area, and a look at copperwindessentials suggests there is more here worth passing along too, definitely a generous resource that deserves a wider audience than it probably has today across the open internet.

  19. A modest masterpiece in its own quiet way, and a look at silversproutstore confirmed the same quiet quality across the rest of the site, calling something a masterpiece is usually overstating but for content this carefully crafted the word feels appropriate even if the writers themselves would probably resist the label honestly.

  20. Top notch writing, every paragraph carries weight and nothing feels like filler, and a stop at neonpickmarket reflected that same care, a rare thing on the open web these days where most pages exist for clicks rather than actual reader value or anything close to that which is honestly a real shame.

  21. Speaking as someone who used to recommend blogs frequently and got out of the habit this site is rekindling that impulse, and a look at perfectbuycorner extended the rekindling, the recovery of an old habit triggered by encountering work that justifies it is itself a small kind of pleasure and this site is providing that recovery experience.

  22. A thoughtful read in a week that has been mostly noisy, and a look at crystalbloommarket carried that thoughtful quality across more pages, finding pockets of considered writing in a week of distractions is one of the small wins of careful curation and this site is providing those pockets at a sustainable rate.

  23. Liked the post enough to read it twice and the second read found new things, and a stop at goodslinkstore similarly rewarded the second look, content with hidden depths that only reveal themselves on careful rereading is the rare kind that earns lasting respect rather than fleeting first impressions only briefly held.

コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です