473,382 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

[perl-python] 20050115, for statement

© # this is an example of for statement
© # the % symbol calculates the remainder
© # of division.
© # the range(m,n) function
© # gives a list from m to n-1.
©
© a = range(1,51)
© for x in a:
© if x % 2 == 0:
© print x, 'even'
©
© # note that in this example, for goes over a list.
© # each time making x the value of the element.
©
© ------------------------------------
© # this is similar code in perl
©
© @a=(1..50);
© for $x (@a) {
© if ( $x%2 ==0){
© print $x, " even\n";
© }}
©
© # PS each daily tip can be run. Just
© # copy the python part and save to a
© # file and run it as "python
© # file.py". Try it.
©
©
© Note: this post is from the Perl-Python
© a-day mailing list at
© http://groups.yahoo.com/group/perl-python/
© to subscribe, send an email to
© pe*******************@yahoogroups.com if
© you are reading it on a web page,
© program examples may not run because
© groups.google.com changes the post slightly.
©
© Xah
© xa*@xahlee.org
© http://xahlee.org/PageTwo_dir/more.html

Jul 18 '05 #1
5 1573
Xah Lee wrote:
© a = range(1,51)
© for x in a:
© if x % 2 == 0:
© print x, 'even'


Now he's mixing tabs and spaces. Hideous.

Are you doing things wrong on purpose?
--
Michael Hoffman
Jul 18 '05 #2
Michael Hoffman wrote:
Xah Lee wrote:
© a = range(1,51)
© for x in a:
© if x % 2 == 0:
© print x, 'even'

Now he's mixing tabs and spaces. Hideous.

Are you doing things wrong on purpose?


Actually Xah is to be commended, since he's united the Perl and Python
camps. Both agree he's a nuisance who is ill-informed about Perl *and*
Python ;-)

I can only presume it's egocentricity that keeps him cross-posting this
nonsense to c.l.py and c.l.pe.misc despite the many deficiencies that
have been remarked upon in both newsgroups.

fraternal-greetings-to-the-perl-wordl-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
Jul 18 '05 #3

Steve Holden wrote:
Michael Hoffman wrote:
Xah Lee wrote:
© a = range(1,51)
© for x in a:
© if x % 2 == 0:
© print x, 'even'

Now he's mixing tabs and spaces. Hideous.

Are you doing things wrong on purpose?


Actually Xah is to be commended, since he's united the Perl and

Python camps. Both agree he's a nuisance who is ill-informed about Perl *and* Python ;-)

I can only presume it's egocentricity that keeps him cross-posting this nonsense to c.l.py and c.l.pe.misc despite the many deficiencies that have been remarked upon in both newsgroups.

fraternal-greetings-to-the-perl-wordl-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119


I humbly suggest that Xah Lee Foxtrot Oscar, failing that would he/she
stand up as the voice is rather muffled. Hardly original I know, but
this crap is getting up my nose.

I would much rather read the Timbot discussing things which mention the
best operating system in the world, i.e. VMS, which for the uninitiated
stands for Very Much Safer.

Mark Lawrence.

Jul 18 '05 #4
On Sat, 15 Jan 2005 10:54:28 +0000, Michael Hoffman wrote:
Xah Lee wrote:
© a = range(1,51)
© for x in a:
© if x % 2 == 0:
© print x, 'even'


Now he's mixing tabs and spaces. Hideous.

Are you doing things wrong on purpose?


I think the most exciting thing is the breath-taking pace he has chosen. I
mean, wow, we've been going for what, five days now and we're up to for
loops? Woo!

So far, even for his stated purpose, he's at negative value vs. just
reading even the simplest tutorials for the languages. The value in
Perl<->Python documentation is to help with idiom translation, syntax is
truly trivial. At the rate he's going, he'll get out of Negative Value and
start entering Colossal Waste Of Time in about a month.

So good on you, Xah Lee. The world needs more people producing things of
negative value and posting them everywhere they can. Wouldn't want The
Masses (TM) to find the good resources, learn, and subsequently compete
with people who know things already.

(Hell, five days into Python and some people are already producing working
Backgammon games (I think that was the post last week), and Xah Lee here
is still on for loops! Woo! Go Xah!)
Jul 18 '05 #5
Jeremy Bowers wrote:
(Hell, five days into Python and some people are already producing working
Backgammon games (I think that was the post last week), and Xah Lee here
is still on for loops! Woo! Go Xah!)


Mah Jongg, actually (if we're thinking of the same post), which
name is often applied in the world of computer games to a what
amounts to the old game of "Concentration" (rather than the real
Mah Jongg which bears no more resemblance to the computerized
version than Bridge bears to Go Fish). The player merely turns
over cards/tiles two at a time and any identical pairs are removed.
A backgammon game, with the computer actually playing against a
human and all the logic that entails, would be much more sophisticated,
and rather more work.

....not to diminish the impressiveness of someone new to Python
building a visually attractive GUI application in only a few days
and delivering it to the web which in several ways is far more
than I've contributed in over five years. ;-) (Doffs hat to the
former newbie who achieved this.)

-Peter
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
6
by: John Smith | last post by:
Hello, I have a rather odd question. My company is an all java/oracle shop. We do everything is Java... no matter what it is... parsing of text files, messaging, gui you name it. My question...
3
by: David F. Skoll | last post by:
Hi, I'm tearing my hair out on this one. I'm trying to embed a Perl interpreter into a C program. I need to be able to create and destroy the interpreter periodically, but will never actually...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
by: Otto J. Makela | last post by:
I'm trying to install to php the Perl-1.0.0.tgz package (from http://pecl.php.net/package/perl, enabling one to call perl libraries) to a pre-existing Solaris system. Unfortunately, the attempt...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.