Hi All,
during my (too) long research on which programming language to learn first, I’ve found an interesting diagram (https://www.dailyinfographic.com/wp-content/uploads/2015/06/OBHEr1J.png).
After it helped me to choose my first language, it also seemed as a good exercise for functions.
Here it is:
def learnPython(): # describes python
print("\n* * * * * * * * * PYTHON * * * * * * * *\n")
print("Widely regarded as the best prgramming language for beginners")
print("Easiest to learn")
print("Widely used in scientific, technical & academic field, i.e. A.I.")
print("You can build website using Django, a popular Python web framework\n")
print("LOTR character:\tThe Ent")
print("Help little Hobbits (beginners) to understand programming concepts")
print("Help Wizards (computer scientists) to conduct researches\n")
print("Difficulty:\t1/5")
print("Popularity:\t4.5/5")
print("Avg. salary:\t$107,000")
print("Platforms:\tWeb, Desktop\n")
def learnJava(): # describes java
print("\n* * * * * * * * * JAVA * * * * * * * *\n")
print("Very popular on all platforms, OS, and devices due to its portability")
print("One of the most in demand & highest paying programming languages")
print("Slogan: write once, work everywhere\n")
print("LOTR character:\tGandalf")
print("Wants peace & works with everyone (portable)\n")
print("Difficulty:\t3/5")
print("Popularity:\t5/5")
print("Avg. salary:\t$102,000")
print("Platforms:\tWeb, Mobile, Desktop\n")
def learnC(): # describes c
print("\n* * * * * * * * * C * * * * * * * *\n")
print("Lingua franca of programming language")
print("One of the oldest and most widely used language in the world")
print("Popular language for system and hardware programming")
print("A subset of C++ except the little details\n")
print("LOTR character:\tOne Ring")
print("The power of C is known to them all")
print("Everyone wants to get its power\n")
print("Difficulty:\t3/5")
print("Popularity:\t5/5")
print("Avg. salary:\t$102,000")
print("Platforms:\tMobile, Desktop\n")
def learnCpp(): # describes c++
print("\n* * * * * * * * * C++ * * * * * * * *\n")
print("Complex version of C with a lot more features")
print("Widely used for developing games, industrial and performance-critical applications")
print("Learning C++ is like learning how to manufacture, assemble and drive a car")
print("Recommended only if you have a mentor to guide you\n")
print("LOTR character:\tSaruman")
print("Everyone thinks that he is a good guy")
print("But once you get to know him, you will realize he wants power, not good deeds\n")
print("Difficulty:\t4/5")
print("Popularity:\t4.5/5")
print("Avg. salary:\t$104,000")
print("Platforms:\tMobile, Desktop\n")
def learnJS(): # describes javascript
print("\n* * * * * * * * * JAVASCRIPT * * * * * * * *\n")
print('"Java and Javascript are similar like Car and Carpet are similar" - Greg Hegwill')
print("Most popular clients-side web scripting language")
print("A must learn for front-end web developer (HTML and CSS as well)")
print("One of the hottest programming language now, due to its increasing popularity as server-side language (node.js)\n")
print("LOTR character:\tHobbit")
print("Frequently underestimated (powerful)")
print("Well-known for the slow, gentle life of the Shire (web browsers)\n")
print("Difficulty:\t2/5")
print("Popularity:\t4/5")
print("Avg. salary:\t$99,000")
print("Platforms:\tWeb, Mobile\n")
def learnCs(): # describes c#
print("\n* * * * * * * * * C# * * * * * * * *\n")
print("A popular choice for enterprise to create websites and Windows application using .NET framework")
print("Can be used to build website with ASP.NET, a web framework from Microsoft")
print("Similar to Java in basic syntax and some features\n")
print("LOTR character:\tElf")
print("Beautiful creature (language), used to stay in their land, Rivendell (Microsoft Platform),")
print("but recently started to open up to their neighbours (open source)\n")
print("Difficulty:\t3/5")
print("Popularity:\t4.5/5")
print("Avg. salary:\t$94,000")
print("Platforms:\tWeb, Mobile, Desktop\n")
def learnRuby(): # describes ruby
print("\n* * * * * * * * * RUBY * * * * * * * *\n")
print("Mostly known for its popular web framework, Ruby on Rails")
print("Focuses on getting things done")
print("Designed for fun and productive coding")
print("Best for fun and personal projects, startups and rapid development\n")
print("LOTR character:\tMan")
print("Very emotional creature")
print("They (some Ruby developers) feel they are superior & need to rule the Middle Earth\n")
print("Difficulty:\t2/5")
print("Popularity:\t3.5/5")
print("Avg. salary:\t$107,000")
print("Platforms:\tWeb, Desktop\n")
def learnPHP(): # describes php
print("\n* * * * * * * * * PHP * * * * * * * *\n")
print("Suitable for building small and simple sites within a short time frame")
print("Supported by almost every web hosting services with lower price\n")
print("LOTR character:\tOrc")
print("Ugly guy (language) and doesn't respect the rules (inconsistent and unpredictable)")
print("Big headache to those (developers) to manage them (codes)")
print("Yet still dominates the Middle Earth (most popular web scripting kanguage)\n")
print("Difficulty:\t2/5")
print("Popularity:\t4/5")
print("Avg. salary:\t$89,000")
print("Platforms:\tWeb\n")
def learnObjectiveC(): # describes objective c
print("\n* * * * * * * * * OBJECTIVE-C * * * * * * * *\n")
print("Primary language used by Apple for Mac OS & iOS")
print("Choose this if you want to focus on developing iOS or OSX apps only")
print("Consider to learn Swift (newly introduced by Apple in 2014) as your next language\n")
print("LOTR character:\tSmaug")
print("Lonely and loves gold\n")
print("Difficulty:\t3/5")
print("Popularity:\t3/5")
print("Avg. salary:\t$107,000")
print("Platforms:\tMobile, Desktop\n")
# prints "invalid answer..." message
def invAns():
print("Invalid answer, please answer again:")
# function represents "Which one is your favorite toy?" node, and calls language description based on user's answer
def favoriteToy():
print("\nWhich one is your favorite toy?")
print("\t1) Lego\n\t2) Play-Doh\n\t3) I have an old & ugly toy, but I love it so much!\n")
while True:
choice = input(">>> ")
if choice == "1":
learnPython()
break
elif choice == "2":
learnRuby()
break
elif choice == "3":
learnPHP()
break
else:
invAns()
# function represents "Auto or Manual car?" node, and calls language description function based on user's answer
def autoOrManual():
print("\nAuto or Manual car?")
print("\t1) Auto\n\t2) Manual\n")
while True:
choice = input(">>> ")
if choice == "1":
learnJava()
break
elif choice == "2":
learnC()
break
else:
invAns()
# function represents "I prefer to learn things..." node, and calls language description or further node function based on user's answer
def preferToLearn():
print("\nI prefer to learn things...")
print("\t1) The easy way\n\t2) The best way\n\t3) The slightly harder way")
print("\t4) The really hard way (but easier to pick up other languages in the future)\n")
while True:
choice = input(">>> ")
if choice == "1":
learnPython()
break
elif choice == "2":
learnPython()
break
elif choice == "3":
autoOrManual()
break
elif choice == "4":
learnCpp()
break
else:
invAns()
# function represents "Do you want to try something new with huge potential, but less mature?" node,
# and calls language description or further node function based on user's answer
def trySomethingNew():
print("\nDo you want to try something new with huge potential, but less mature?")
print("\t1) Yes\n\t2) Not sure\n\t3) No\n")
while True:
choice = input(">>> ")
if choice == "1":
learnJS()
break
elif choice == "2" or choice == "3":
favoriteToy()
break
else:
invAns()
# function represents "Does your web app provide info in real-time, like twitter?" node,
# and calls language description or further node function based on user's answer
def realTimeInfo():
print("\nDoes your web app provide info in real-time, like twitter?")
print("\t1) Yes\n\t2) No\n")
while True:
choice = input(">>> ")
if choice == "1":
learnJS()
break
elif choice == "2":
trySomethingNew()
break
else:
invAns()
# function represents "What do you think about Microsoft?" node, and calls language description function based on user's answer
def thinkOfMS():
print("\nWhat do you think about Microsoft?")
print("\t1) I'm a fan :)\n\t2) Not bad :|\n\t3) Sucks :(\n")
while True:
choice = input(">>> ")
if choice == "1":
learnCs()
break
elif choice == "2" or choice == "3":
learnJava()
break
else:
invAns()
# function represents "Which OS?" (Mobile) node and calls language description function based on user's answer
def whichOS():
print("\nWhich OS?")
print("\t1) iOS\n\t2) Android\n")
while True:
choice = input(">>> ")
if choice == "1":
learnObjectiveC()
break
elif choice == "2":
learnJava()
break
else:
invAns()
# function represents "Which platform/field?" node (on the right side of the diagram), and calls further node function based on user's answer
def whichPlatformField():
print("\nWhich platform/field?")
print("\t1) Web\n\t2) Enterprise\n\t3) Mobile\n\t4) 3D/Gaming\n")
while True:
choice = input(">>> ")
if choice == "1":
realTimeInfo()
break
elif choice == "2":
thinkOfMS()
break
elif choice == "3":
whichOS()
break
elif choice == "4":
learnCpp()
break
else:
invAns()
# function represents "Have a brilliant idea/paltform in mind?" node, and calls further node functions based on user's answer
def brilliantIdeaPlatform():
print("\nHave a brilliant idea/platform in mind?")
print("\t1) Yes\n\t2) Nope. Just want to get started\n")
while True:
choice = input(">>> ")
if choice == "1":
whichPlatformField()
break
elif choice == "2":
preferToLearn()
break
else:
invAns()
# function represents "I want to work for big tech companies" node, and calls language description function based on user's answer
def bigTechCompany():
print("\nWhich big tech company do you want to work for?")
print("\t1) Facebook\n\t2) Google\n\t3) Microsoft\n\t4) Apple\n")
while True:
choice = input(">>> ")
if choice == "1" or choice == "2":
learnPython()
break
elif choice == "3":
learnCs()
break
elif choice == "4":
learnObjectiveC()
break
else:
invAns()
# function represents "I want to work for..." node, and calls further node function based on user's answer
def wantToWorkFor():
print("\nI want to work for...")
print("\t1) Corporate\n\t2) Startup\n")
while True:
choice = input(">>> ")
if choice == "1":
thinkOfMS()
break
elif choice == "2":
trySomethingNew()
break
else:
invAns()
# function represents "Web" node, and calls language description or further node function based on user's answer
def webChoice():
print("\nWhich web?")
print('\t1) Front-End (web interface)\n\t2) Back-End ("brain" behind a website)\n')
while True:
choice = input(">>> ")
if choice == "1":
learnJS()
break
elif choice == "2":
wantToWorkFor()
break
else:
invAns()
# function represents "Which platform/field?" (on the left side of the diagram),
# and calls language description or further node function based on user's answer
def jobPlatformField():
print("\nWhich platform/field?")
print("\t1) I want to work for big tech company")
print("\t2) Doesn't matter, I just want $$$")
print("\t3) Web\n\t4) Enterprise\n\t5) Mobile\n\t6) 3D/Gaming\n")
while True:
choice = input(">>> ")
if choice == "1":
bigTechCompany()
break
elif choice == "2":
learnJava()
break
elif choice == "3":
webChoice()
break
elif choice == "4":
thinkOfMS()
break
elif choice == "5":
whichOS()
break
elif choice == "6":
learnCpp()
break
else:
invAns()
# function represents "Make money" node, and calls further node function based on user's answer
def howMakeMoney():
print("\nHow to make money?")
print("\t1) Get a job\n\t2) I have a startup idea!\n")
while True:
choice = input(">>> ")
if choice == "1":
jobPlatformField()
break
elif choice == "2":
whichPlatformField()
break
else:
invAns()
# starting function, represents "Why do you want to learn programming?" node,
# and calls further node function based on user's answer
def start():
print("\nWhy do you want to learn programming?")
print("\t1) Make money\n\t2) Just for fun\n\t3) I'm interested")
print("\t4) Improve myself\n\t5) For my kids\n\t6) I don't know, just pick one for me\n")
while True:
choice = input(">>> ")
if choice == "1":
howMakeMoney()
break
elif choice == "2" or choice == "3" or choice == "4":
brilliantIdeaPlatform()
break
elif choice == "5":
print("\nStart with Scratch, then move on to...")
learnPython()
break
elif choice == "6":
learnPython()
break
else:
invAns()
print("Welcome to...\n")
print("-------------------- WHICH PROGRAMMING LANGUAGE SHOULD I LEARN FIRST --------------------")
print("--------------------------------- LOTR Special Edition ----------------------------------")
print("\nThis program is designed to help you choose your first programing language.")
print("Read the questions and answer them by typing the answer number and pressing Enter.")
start()
edit:
it’s in Python 3