From the last lesson, you must be well acquainted with the black/blue screen and made it your best friend. We'll be using the terminal to write our first Python program today. This is a very basic program that every programmer usually writes when they start out with programming. It's called the
Hello World program. So, let's get started with it.
Step 1 : Fire up python. Open terminal/powershell and type
python. It should start a python console and you should see a message like :
Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.>>>
Now, let's type the program.
print "Hello World!"
If you use python3, try
If you noticed in Python3,
print "Hello World!" throws an error and doesn't work as intended. It says
SyntaxError: Missing parentheses in call to 'print'
It clearly tells us that parentheses is missing in call to print. But why? Let's figure it out the programmer way.
# Hello World program in Python print "Hello World!" print "Hello Again" print "I like typing this." print "This is fun." print 'Yay! Printing.' print "I'd much rather you 'not'." print 'I "said" do not touch this.'
TASK #1(only for beginners) :
Write a python program to print the following (include the quotes).
"" 'Steem Python' "" Ahead
100% upvote to the first correct answer submitted +1 SBD
TASK #2(open for all) : Judge and Sponsor : @pharesim
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed 400000, find the sum of the even-valued terms.
Reward : 25 SBD to the best solution
Please submit your answer in the comment section below. You can discuss the program and clear your queries regarding this topic if any. Thanks!
WINNERS OF THE LAST CHALLENGE
Our Judge @pharesim has decided to split the rewards amongst both since there were only 2 submissions and he feels both of them are deserving. They both shall receive 12.5 SBD each