Skip to main content
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also PerlSee also Perl

See also RubySee also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names
edited body; edited tags
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names
added 15 characters in body
Source Link
13aal
  • 832
  • 1
  • 9
  • 30

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out

I've created a program for my own purposes in three different languages, Perl, Python, and Ruby. Each program will be posted in with their own tag but I will add links to them through on each post. The program itself is very simple, all it does is ask the user about three different languages which are saved into an array, it then prompts the user to choose a language that runs through an if statement, and if the user chooses the language they're writing in it then takes a random language from the array and outputs it.

See also Perl

See also Ruby

Python:

import random

def welcome():
    choices = ["Perl", "Python", "Ruby"]
    lang = 3
    print "Welcome, to the test script, this will test what language you would like to learn.. In order to find out these choices, write this same definition in all three different languages\n"
    print "There are", lang, "languages to choose from please pick one\n"
    user_choice = raw_input(choices)
    if user_choice == "Ruby":
        print("You have chosen Ruby!\n")
    elif user_choice == "Perl":
        print("You have chosen Perl!\n")
    else: 
        print("You're already writing in Python!! Let me choose for you! ")
        print random.choice(["Perl", "Ruby"])
welcome()

Creating this program in Python was actually fairly easy, it was my second program I've ever written in Python and reminds me a lot of Ruby. However I kept getting an error while running it due to the fact that I didn't import random, after figuring this out I found out that I had to write out each language's name instead of making it random from the array.. Also Python ended up being the shortest maxing out at 22 lines, I will be adding the execution time of the program shortly.

I also have some questions about Python:

  • In Python is there a equivalent to Ruby's puts?
  • In the function print random.choice(["Perl", "Ruby"]) is there a way I can pull from the array instead of having to write out language names
added 129 characters in body
Source Link
13aal
  • 832
  • 1
  • 9
  • 30
Loading
added 129 characters in body
Source Link
13aal
  • 832
  • 1
  • 9
  • 30
Loading
Source Link
13aal
  • 832
  • 1
  • 9
  • 30
Loading