01. LPTHW (A Good First Program - ex1.py) || Announcement of the winners of the last challenge. || New challenges at the end.

in #python7 years ago

Hello Steem!

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.>>>

pyconsole.png


Now, let's type the program.

Type:

print "Hello World!"
py2.7.png

If you use python3, try

print("Hello World!")
py3.6.png

Note:
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.

google.png

g1.png

stack1.png

exp.png

Follow the full thread here


ex1.py

# 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

Reward :

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




ely.png




AND





veleje.png







CONGRATULATIONS TO BOTH THE PROGRAMMERS!


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

Sort:  

@isteemit
I have sent you wrongly 5 steem few minutes ago with post link in comment.
Please, send me this 5 steem back. Thanks.
https://busy.org/@mehta/6yfrkk

hi dear steemit iam a new member in steemit
i will be happy that you see my blog and share your idea and sujjestion how to inprove my blog
thank for your support

Loading...