Created
January 2, 2022 15:31
-
-
Save logankilpatrick/9334e6f92539e4519a27b0ee20952796 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mad Libs in Julia | |
# Source: https://github.com/logankilpatrick/10-Julia-Projects-for-Beginners | |
function play_mad_libs() | |
print("Enter a verb (action): ") | |
verb1 = readline() | |
print("Enter an adjective (descriptive word): ") | |
adj1 = readline() | |
print("Enter a noun (person place or thing): ") | |
noun1 = readline() | |
print("Enter another noun (person place or thing): ") | |
noun2 = readline() | |
print("Enter a catchphrase (something like 'hands up!'): ") | |
phrase1 = readline() | |
base_sentence = "John $verb1 down the street one night, playing with his $adj1 $noun1. When all of a / | |
sudden, a $noun2 jumped out at him and said $phrase1" | |
print("\n\n", base_sentence) | |
end | |
play_mad_libs() |
Author
logankilpatrick
commented
Oct 11, 2022
via email
Hey, mind opening an issue here: https://github.com/logankilpatrick/Julia-Projects-for-Beginners
… On Mar 23, 2022, at 8:33 AM, Olga Eleftherakou ***@***.***> wrote:
***@***.*** commented on this gist.
There is something weird. I am trying to run my function and I have a problem with the readline() and print() as I have with your code too. The user needs to know what to put in the input, so it is needed for the print phrase to be shown first. But, when I run the code in jupyter notebook, it shows me only the inputs. When I type the inputs, the function run and print:
Firstly: My inputs
Secondly: The print phrases
Thirdly: The base sentence
(The same for the five inputs)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment