Python Forum
Help with a random.randint choice in Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a random.randint choice in Python
#6
I would put all the messages in a list, as you do, but without the intermediate step of assigning them to a variable first.
import random

messages = [
    "I Love you more than...",
    "I wish I could give you...",
    "I love you so muchhhhhhhh...",
    "I really hope you days are...",
    "Your one of my favorite people...",
    "I understand how you feel..."
]

print("Hi! I really missed seeing you today </3")
print("I was wondering about how you were feeling.")
print("I remembered that you said that most day's you were feeling down...I was hoping maybe I could cheer you up maybe even a little with some jokes and stuff,,,;-;")
hru = input("How are you feeling today then..? ")
if hru in ["Good", "good", "great", "Great", "okay", "fine"]:
    print("I'm glad to hear that your day is going well, I hope it stays okay, just remember that I'm here for you <3")
else:
    print(random.choice(messages))
Actually I think I would put the messages in a file so they could be easily changed.
with open('daily_affirmation.txt', 'r') as file:
    messages = file.readlines()
booponion likes this post
Reply


Messages In This Thread
RE: Help with a random.randint choice in Python - by deanhystad - Oct-23-2020, 05:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  random numbers, randint janeik 2 562 Nov-27-2023, 05:17 PM
Last Post: janeik
  Unexpected output while using random.randint with def terickson2367 1 508 Oct-24-2023, 05:56 AM
Last Post: buran
  combobox_callback(choice choice part of openfile name (kind of dependency) janeik 9 1,432 Sep-10-2023, 10:27 PM
Last Post: janeik
Sad Iterate randint() multiple times when calling a function Jake123 2 2,040 Feb-15-2022, 10:56 PM
Last Post: deanhystad
  random.choice HELP samuelbachorik 4 2,262 Aug-18-2021, 03:24 PM
Last Post: naughtyCat
  Unable to use random.choice(list) in async method spacedog 4 3,418 Apr-29-2021, 04:08 PM
Last Post: spacedog
  Using Dictionary to Test Evenness of Distribution Generated by Randint Function new_coder_231013 6 3,256 Feb-23-2021, 01:29 PM
Last Post: new_coder_231013
  ???: if "{choice}" in self._command BaiYouLing4 3 2,020 Aug-23-2020, 05:40 AM
Last Post: BaiYouLing4
  trying to input a variable using random.choice python63 9 3,609 Aug-13-2020, 05:37 PM
Last Post: python63
  Random Choice Operations Souls99 6 2,922 Jul-31-2020, 10:37 PM
Last Post: Souls99

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020