Python Forum
Printing one thing from a list
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing one thing from a list
#1
I'm trying to see if I can make something in Python that can make a sentence. The only way I can think to do this is by making the process go, "If I choose an 'I', than after that I should put (insert multiple things that would make sense to go after 'I' here)". Problem is I'm a noob at Python knowing next to nothing about how to use it. The most I could do is assign values and make it print out a math equation. I'm wondering if I can make it go like this:

print([One item from list A] [Item from list corresponding to the word from list A] [Item corresponding to that list]...) ect ect until a sentence is made.

Pry not the best way to do this but I thought it'd be a nice project.
Reply
#2
I would do it like MadLibs. A sentence with blanks in it, each blank having a part of speech (noun, verb, adjective). Then you have a list of nouns, a list of verbs, and a list of adjectives. Use random.choice to pick random words of the right parts of speech to fill in the blanks in the sentence.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I am confused with the key and value thing james1019 3 943 Feb-22-2023, 10:43 PM
Last Post: deanhystad
  Need help i just started the whole thing gabriel789 16 3,174 Sep-12-2022, 08:04 PM
Last Post: snippsat
Question Printing through list.. again jesse68 2 1,134 Apr-16-2022, 03:24 PM
Last Post: jesse68
  i making a terminal sign up website thing Kenrichppython 1 1,687 Nov-04-2021, 03:57 AM
Last Post: bowlofred
  use thing before self sylvanas 3 2,333 Jul-21-2021, 04:54 PM
Last Post: sylvanas
  help for list printing jip31 8 3,606 May-01-2021, 03:52 AM
Last Post: Pedroski55
  Not able to make a specific thing pause in pygame cooImanreebro 4 3,193 Dec-13-2020, 10:34 PM
Last Post: cooImanreebro
  Problem printing last element from a list tester_V 3 2,365 Oct-30-2020, 04:54 AM
Last Post: tester_V
  Printing empty list? hhydration 2 2,103 Oct-28-2020, 11:34 AM
Last Post: Atekka
  Printing images from a list Heyjoe 4 2,794 Jun-22-2020, 02:28 AM
Last Post: Heyjoe

Forum Jump:

User Panel Messages

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