Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,207,749 members, 8,000,184 topics. Date: Tuesday, 12 November 2024 at 02:15 AM

Python Programming - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Python Programming (63098 Views)

Anyone That Know Python Programming Should Help Me To Check The Eorr This / Support Python Programming With Android Devices :qpython E.t.c / What Can Python Programming Language Build? (2) (3) (4)

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (14) (Reply) (Go Down)

Re: Python Programming by pystar: 11:10pm On Oct 30, 2008
One of the features of python which i like so much and can hardly do without in my code is called "Lists" or otherwise called "arrays" in other languages.
This is just a short introduction to lists in Python.
***************************************************************************
A list in Python can hold arbitrary objects in it, and a List in Python is known as a "container object", because it holds other objects within itself. A list is also mutable in nature. i.e. in Python, an object is either mutable or immutable. a mutable object is an object that can be modified or changed in place without creating a new copy of that object.
The official definition of a List Object in Python is: "A List is an ordered collection of arbitrary objects". A List can also be said to be a sequence object, because you use the index of an object within a list to retrieve that list object item.
Now to some code:
*******************************************
To define a list in Python is as easy as this:

"The list name" = [objects in the list]
e.g
states = ["lagos", "edo", "kogi", kano", "imo"]
to retrieve the object stored in the first index of the "states" list, we do this states[0], P.S: all sequences or lists start from zero.

Lists are indispendsible when dealing with collection of objects in your code which will be modified in place during execution by a user, and it becomes more useful when combined with the "sequence iteration operator" i.e.
>>>for state in states:
print state

The above code snippet goes through the states list and prints out all the states in the list, till it reaches the end of the list.
*************************************************************************************************
I will be stopping hear for now, whenever i have time, i will post more stuff, lets share our knowledge.
thanks
Re: Python Programming by alexis(m): 9:54am On Oct 31, 2008
@dami9ja,

I am sorry jare, been so busy. I haven't been following the thread, just checked it yesterday. I am excited that we have people that love python. I have listed the pros and cons of python in my earlier post. I will start the tutorial again but let me answer a few questions.

@Seun

Like I said, never used CherryPy but I am aware it is a object-oriented HTTP framework. So, I am kind of surprised you don't do OOP but hey - it's flexible to allow you code in the way you want. There are many reasons we use different frameworks, you mentioned what you like in a framework. web2py satisfy the requirements you mentioned and much more.

1) web2py is very stable since day one so it performs very well
2) Similar to Django. All request data is in one place. You can use .get_vars and .post_vars instead of .vars to be more specific.
3) CherryPy works very much like Rails and default mapping between URL and action can be overwritten. Similar to Rails and CherryPy but, by default the URL requires that you specify the name of the app. This allows web2py to run multiple apps without using routes. Web2py has its own version of routes that supports two different syntax's (with and without regular expression) to overwrite the mapping and reverse mapping as well.

Reasons I like web2py

1) Model-View-Controller design - Web frameworks implement MVC support in different ways and as a result, they might force you to do things in certain ways i.e. I learned that from CakePHP.
2) Does not require any third party library. Only Python 2.5 standard libraries.
3) Designed for security. URLs are validated, forms are validated, template variables are escaped, SQL is escaped, no client side storage (other than session cookie) and it never exposes application code. FORMs enforce navigation and prevent double submission.
4) A database administrative interface to browse, insert, edit, update and delete records. It also allows import/export in csv.
5) Database Abstraction Layer for interfacing the database in Python without SQL
6) View/Template language with full Python support but with no indentation requirements
7) Full web based application development, deployment and administration
cool Zero installation - I love this
9) Web based Module Designer - Sweeeeeeet!
10) Caching - Can specify where to cache and what to cache

web2py is wsgi compliant.comes with the cherrypy wsgi fast and ssl-enabled web server. It runs with apache and mod_proxy or mod_rewrite or mod_wsgi. It runs with lightpd with FastCGI. It runs as CGI script.

It is very well documented. I will talk about Django in my next post.

Again, I am excited I am talking to other python developers. Heard Python 3 is coming out, can't wait.

1 Like

Re: Python Programming by alexis(m): 10:11am On Oct 31, 2008
I don't see why one can't use a python framework web server, there is nothing wrong with it. However, when it comes to scalability and flexibility - it is advisable to proxy a framework web server through Apache.

My reasons are simple

1. Apache is well known and most people know how to use it
2. Pretty stable and you can scale well.

@pystar

I do a lot of internal web stuff. We have funny requirements where I work. I mainly use python to write network scripts and recently started using web2py and django

On Google App Engine
web2py is the only framework that allows to develop on your own platform and then run the app, unmodified on the Google App Engine (with the limitations imposed by the App Engine). No need to rewrite the model since the web2py database abstraction layer supports the Google Query Language.

@WordSmith
Nope, haven't written any desktop app so I can't advice in this area. What kind of GUI app would you like to build?

1 Like

Re: Python Programming by alexis(m): 5:22pm On Nov 06, 2008
Hi Guys,

In our last tutorial, we made use of Python variables, operators, strings etc. Today, we will be dealing with Branching, while Loops, and Program Planning. These are some of the stuffs you will learn:

1. Using randrange() to generate random numbers
2. Use if structures to execute code based on a condition
3. Use if-else structures to make a choice based on a condition
4. Use if-else-elif structures to make a choice based on several conditions
5. Use while loops to repeat parts of your program

GENERATING RANDOM NUMBERS

Sometimes we wonder how a game can change it's strategy or an alien appears out of nowhere. Random numbers can supply this element of surprise. Python provides an easy way to generate random numbers.

Let us simulate the roll of two, six-sided dice. The program will display the value of each dice and their total. To determine the dice values, the program uses a function that generates random numbers.

Here is the Python Code

# This Program demonstrates random number generation
# Alex Dehaini - November 5th, 2008 - (The day Obama won the elections, hehe)

import random

# generate random numbers 1 - 6
die1 = random.randrange(6) + 1
die2 = random.randrange(6) + 1

total = die1 + die2

print "You rolled a", die1, "and a", die2, "for a total of", total

raw_input("\n\nPress the enter key to exit."wink


EXPLANATION

Using the import Statement
The first line of code in the program introduces the import statement. The statement allows you to import, or load, modules, in this case the random module in:

import random

Modules are files that contain code meant to be used in other programs. These modules usually group together a collection of programming related to one area. The random module contains functions related to generating random numbers and producing random results.

Once you import a module, you can use its code. Then, it just becomes a matter of accessing it.

Accessing randrange()
The random module contains a function, randrange(), which produces a random integer. The program accesses randrange() through the following function call:

random.randrange(6)

You'll notice the program doesn't directly call randrange(). Instead, it's called with random.randrange(), because the program accesses randrange() through its module, random. In general, you can call a function from an imported module by giving the module name, followed by a period, followed by the function call itself. This method of access is called dot notation. Dot notation is like the possessive in English. In English, "Mike's Ferrari" means that it's the Ferrari that belongs to Mike. Using dot notation, random.randrange() means the function randrange() that belongs to the module random. Dot notation can be used to access different elements of imported modules.

Now that you know how to access randrange(), you need to know how to use it.

Using randrange()
There are several ways to call randrange(), but the simplest is to use a single, positive, integer argument. Called this way, the function returns a random integer from, and including, 0, up to, but not including, that number. So the call random.randrange(6) produces either a 0, 1, 2, 3, 4, or 5. Alright, where's the 6? Well, randrange() is picking a random number from a group of six numbers—and the list of numbers starts with 0. You may think this is odd, but you'll find that most computer languages start counting at 0 instead of 1. So, I just added 1 to the result to get the right values for a die:

die1 = random.randrange(6) + 1

Now, die1 gets either a 1, 2, 3, 4, 5, or 6.

Oya, save your file as random.py and run in on your command line or terminal. Coll huh?

4 Likes 2 Shares

Re: Python Programming by Seun(m): 12:07pm On Nov 09, 2008
I'm still following this thread. Keep up the good work. It seems your students are not responding.
Re: Python Programming by alexis(m): 10:37pm On Nov 10, 2008
Hi Seun,

Well, I will continue to update the tutorial as time permit.

I have a good friend that has taken keen interest in cherrypy - I think he has built a couple of apps with them i.e. a system for searching of hotels in west africa and a couple of others. I downloaded and tried it, pretty neat.
Re: Python Programming by alexis(m): 10:17pm On Nov 13, 2008
Let's continue our python tutorial. Let us look at the if structure today.

Using the if Structure
Branching is a fundamental part of computer programming. It basically means making a decision to take one path or another. Through the if structure, your programs can branch to a section of code or just skip it, all based on how you've set things up.

Let us create a simple program that will ask you for a password & compare the password with a string.

Ready? - Oya, fire

Here is the program code for Password:

# Password
# Demonstrates the if structure
# Alex Dehaini - 13/11/2008

print "Welcome to Combat Jujistu Inc."
print "— where combat training is our middle name\n"

password = raw_input("Enter your access code: "wink

if password == "jujistu":
    print "Access Granted"

raw_input("\n\nPress the enter key to exit."wink



Examining the if Structure
The key to program Password is the if structure:

if password == "jujistu":
    print "Access Granted"


The if structure is pretty straightforward. You can probably figure out what's happening just by reading the code. If password is equal to "secret", then "Access Granted" is printed and the program continues to the next statement. But, if it isn't equal to "secret", the program does not print the message and continues directly to the next statement following the if structure.

Using the if-else Structure
Sometimes you'll want your program to "make a choice" based on a condition: do one thing if the condition is true, do something else if it's false. The if-else structure gives you that power.

Here is the code:

# Demonstrates the if-else structure
# Alex Dehaini - 13/11/2008

print "Welcome to Combat Jujistu Inc."
print "— where combat training is our middle name\n"

password = raw_input("Enter your access code: "wink

if password == "jujistu":
    print "Access Granted"
else:
    print "Access Denied"

raw_input("\n\nPress the enter key to exit."wink



Examining the else Statement
I only made one change from the first  program. I added an else clause to create an if-else structure:

if password == "jujistu":
    print "Access Granted"
else:
    print "Access Denied"


If the value of password is equal to "secret", the program prints Access Granted, just like before. But now, thanks to the else statement, the program prints Access Denied otherwise.

In an if-else structure, you're guaranteed that exactly one of the code blocks will execute. If the condition is true, then the block immediately following the condition is executed. If the condition is false, then the block immediately after the else is executed.

3 Likes

Re: Python Programming by EDIPO(m): 3:32pm On Nov 17, 2008
hey guys, i am new at python and doing some personal readings.

here are some problems i can get to solve alone, can you just help out please?

**A certain CS professorgives5-pointquizzesthat are graded on the scale 5-A,4-B, 3-C, 2-D,1-E, 0-F. Write a program that accepts a quiz score as an input and prints out the corresponding grade.

**A certain CS professor gives 100-point exams that are graded on the scale 90–100:A, 80–89:B, 70–79: C, 60–69: D, 60:F. Write a program that accepts an exam score as input and prints out the corresponding grade.

**An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, RAM is an acronym for “random access memory.” Write a program that allows the user to type in a phrase and outputs the acronym for that phrase. Note: the acronym should be all uppercase, even if the words in the phrase are not capitalized.

**Numerologists claim to be able to determine a persons character traits based on the “numeric value” of a name. The value of a name is determined by summing up the values of the letters of the name where a is 1, b is 2, c is 3 etc., up to z being 26. For example, the name “Zelle” would have the 26+5+ 12+ 12+ 5= 60 (which happens to be a very auspicious number, by the way). Write a program that calculates the numeric value of a single name provided as an input.26

** Expand your solution to the previous problem to allow the calculation of a complete name such as “John Marvin Zelle” or “John Jacob Jingleheimer Smith.” The total value is just the sum of the numeric value for each name

** A Caesar cipher is a simple substitution cipher based on the idea of shifting each letter of the plain text message a fixed number (called the key) of positions in the alphabet. For example, if the key value is 2, the word “Sourpuss ”would be encoded as “Uqwtrwuu.” The original message can be recovered by “reencoding” it using the negative of the key. Write a program that can encode and decode Caesar ciphers. The input to the program will be a string of plaintext and the value of the key. The output will be an encoded message where each character in the original message is replaced by shifting it key characters in the ASCII character set. For example, if ch is a character in the string and key is the amount to shift, then the character that replaces ch can be calculated as: chr (ord(ch) + key).


** One problem with the previous exercise is that it does not deal with the case when we “drop off the end” of the alphabet (or ASCII encodings). A true Caesar cipher does the shifting in a circular fashion where the next character after “z” is “a”. Modify your solution to the previous problem to make it circular. You may assume that the input consists only of letters and spaces.

** Write a program that counts the number of words in a sentence entered by the user.

** Write a program that calculates the average word length in a sentence entered by the user.

** Word count. A common utility on Unix/Linux systems is a small program called “wc.” This program analyzes a file to determine the number of lines, words, and characters contained therein. Write your own version of wc. The program should accept a file name as input and then print three numbers showing the count of lines, words, and characters in the file.


thanks as i look out for your responses.

1 Like

Re: Python Programming by alexis(m): 12:48pm On Nov 18, 2008
E_DIPO

I will help only if you attempt the questions.
Re: Python Programming by jacob05(m): 12:05pm On Nov 19, 2008
Hi to all am jacob and am 17 with a bit of programming experience that i have i think i can solve all your questions





Solution 1


a=input("enter score: " )

grade=[5:A,4:B,3:C,2cheesy,1:E,0:F]


B=grade.keys(a)

print B




pardon me if these is not correct or properly stated cos am using my phone(free browsing) if it isn't correct it might be the area of B=grade.keys(a) i will revise when i get on my pc
Re: Python Programming by jacob05(m): 12:06pm On Nov 19, 2008
Hi to all am jacob and am 17 with a bit of programming experience that i have i think i can solve all your questions





Solution 1


a=input("enter score: " )

grade=[5:A,4:B,3:C,2cheesy,1:E,0:F]


B=grade.keys(a)

print B




pardon me if these is not correct or properly stated cos am using my phone(free browsing) if it isn't correct it might be the area of B=grade.keys(a) i will revise when i get on my pc
Re: Python Programming by jacob05(m): 9:51pm On Nov 19, 2008
Solution (CORRECT)

a=input("enter score: " )

grade={5:'A',4:'B',3:'C',2:'D',1:'E',0:'F'}

if a > 5:
print 'Out of Grade Range'
else:
B=grade[a]
print B


i will be solving the other one's later
Re: Python Programming by jacob05(m): 10:44pm On Nov 19, 2008
solution 2

a=int(raw_input("enter score: " ))

if 59 < a > 100 :
print " Input Greater Than 100 or Input Less the 60"
else:
if a in range(90,101):
print " Your Grade is A"
if a in range(80,90):
print "Your Grade is B "
if a in range(70,80):
print "Your Grade is C"
if a in range(61, 70):
print "Your Grade is D"
if a==60:
print "Your Grade is F"
Re: Python Programming by EDIPO(m): 12:55pm On Nov 24, 2008
@ alexis,

hey thanks for the encouragement.

i have actually tried some but there are some i just do not even understand what the question expects me to do.

if you help me with some, you can also give hints on some and i would try to figure out the solution.

i have to write my OCA exams on saturday so i am shifting attention more to my oca preps for the main time. nonetheless, i hope to return to python tutorials by monday after my OCA.

kindly help with the questions. also, i dont understand how to define classes and also call class modules. hope you can help with that as well.

thanks.
Re: Python Programming by EDIPO(m): 1:03pm On Nov 24, 2008
@ alexis,

please do you have the code for graphics.py.

i saw a reference to it on john zelle's introduction to computer science text book but do not have the codes.

if you have kindly help me write it out on a python GUI and send it as an attachment to me please.

my email add is e_dipo81@yahoo.com

thanks.
Re: Python Programming by nic121: 1:54pm On Nov 25, 2008
do you have the installer for wxpython im not i have tried downloading it but it keeps telling me to go for pre-requsites i want a shortcut thanks
Re: Python Programming by donkoleone(m): 2:39pm On Nov 25, 2008
jacooooooooooooooooooob, when will u realise the fact dat the ease of desktop application creation is all in JAVAs hands
Re: Python Programming by EDIPO(m): 3:20pm On Nov 26, 2008
@ donkoleone,

i do not think i can return to java.

i am all in for python!

jacob, can you please help with the remaining part of the questions or just give explanations, i hope to resume tutorials by tuesday nextweek after my OCA exams.

best regards.
Re: Python Programming by Seun(m): 9:30pm On Nov 26, 2008
nic121:

do you have the installer for wxpython I'm not i have tried downloading it but it keeps telling me to go for pre-requsites i want a shortcut thanks

wxPython for Python 2.5: http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-ansi-2.8.9.1-py25.exe
wxPython for Python 2.6: http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-ansi-2.8.9.1-py26.exe
Re: Python Programming by jacob05(m): 12:57am On Nov 27, 2008
E_DIPO:

@ donkoleone,
i am all in for python!

jacob, can you please help with the remaining part of the questions or just give explanations, i hope to resume tutorials by tuesday nextweek after my OCA exams.

best regards.

i don't quiet get the acronym question is it only for ram alone or for want? cause acronym words are relatively many


but for the 4$th question  this is the code

letters=('$abcdefghijklmnopqrstuvwxyz')
name=raw_input("Enter Name> "wink.lower()
name=name[0]
if name in letters:
    num=letters.find(name)
    numeric_value=num+5+12+12+5
    print "Your Numeric value is "+ str(numeric_value)
else:
    print "Unknown name"
Re: Python Programming by jacob05(m): 11:09am On Nov 27, 2008
Answer to 5th question

print "[1] to encode\n[2] to decode"

i= raw_input("Enter option> "wink
if i =='1':

word=raw_input("Enter word to encode> "wink

while len(word) == 0:

word=raw_input("Enter word to encode> "wink

for each in word:

maps=chr(ord(each) + 2)

print maps,

if i == '2':
word=raw_input("Enter word to decode> "wink

while len(word) == 0:

word=raw_input("Enter word to decode> "wink

for each in word:

maps=chr(ord(each) - 2)

print maps,
elif i not in ('1','2'):
print "Input unknown"
Re: Python Programming by jacob05(m): 10:28am On Dec 03, 2008
It looks like no one is posting where are you E_DIPO,donkoleone,alexis embarassed undecided cry
Re: Python Programming by jacob05(m): 10:29am On Dec 03, 2008
It looks like no one is posting where are you E_DIPO,donkoleone,alexis,pystar Etc  embarassed undecided cry
Re: Python Programming by Seun(m): 12:13pm On Dec 04, 2008
I think what we need to do is separate this thread into two sections:
    Python Programming and Python Language Tutorial

func = lambda n:n*func(n-1) if n else 1
Can anyone interpret the above function?

Another Tutorial: http://personalpages.tds.net/~kent37/stories/00020.html#e20can-be-learned-in-a-few-days
Re: Python Programming by jacob05(m): 9:55pm On Dec 04, 2008
Seun:

I think what we need to do is separate this thread into two sections:
    Python Programming and Python Language Tutorial

func = lambda n:n*func(n-1) if n else 1
Can anyone interpret the above function?

Another Tutorial: http://personalpages.tds.net/~kent37/stories/00020.html#e20can-be-learned-in-a-few-days
@ Bros Seun
Thanks for the commendations in the other thread you don,t know how glad i am Even my Father and Mother had never commended me my on this programming thing they look at me as a kid although am 17 but clicking 18 next month.

About the Func

To me it is a like a range multiplier it receives a figure and multiple it by the corresponding (n-1) figure if the number got is not n or if it number is 0 it returns 1 But if n i continue the loop until the number got is  Not n 0r = 0

example:
func(1) = 1

the loop subtract 1 from 1 but the value got is 0 which is not n it returns 1 and breaks then multiple 1 by 1
which is equal to 1

func(2)=2

the loop subtract 1 from 2 it value got is 1 and multiples 1 by 2 the result 2 but since the value got (1) is still n the loop continues and subtract 1 from 1 but the value got is 0 the loop the return 1 and breaks then multiple 1 by 2 which equals 2

func(3)=6

the loop subtract 1 from 3 it got 2 and multiples 3 by 2 the result is 6 but the value got (2) is still n and the loop continues and  subtract
1 from 2 the result is 1 and multiples the previous value which is 6 by 1 which equals 6 still the value got (1) is still n and continues by subtracting 1 from 1 but the result is 0 and return 1 then break the loop and the multiple the previous result (6) by 1 which equals 6

func(4) =24
4*func(4-1)= 4 *3 =12 continues result 3
12*func(3-1)=12*2 = 24 continues result 2
24*func(2-1)=24*1= 24 continues result 1
24*func(1-1) ""value equals 0 and breaks then return 1""" = 24 *1 = 24  final!!!

func(5) = 120

1*1*2*3*4*5=120

func(6) =720

1*1*2*3*4*5*6=720


Hope i Got it Bro Seun undecided
Re: Python Programming by jacob05(m): 12:47am On Dec 05, 2008
** Write a program that counts the number of words in a sentence entered by the user.
Solution:
def NumWord(sentence):
words=sentence.split()
len_words=len(words)
if len_words==1:print 'You Just Entered a Word'
else:print 'You Have ',len_words,' Words in Your Sentence!!!'
Re: Python Programming by jacob05(m): 1:46am On Dec 05, 2008
** Write a program that calculates the average word length in a sentence entered by the user.
Solution:

def AvergeWord(sentence):
words=sentence.split()
len_words=len(words)
if len_words==1:print 'You Just Entered a Word'
else:
total=0
for i in range(0,len_words):
total +=len(words[i])
print total
average=total/float(len_words)
print 'The Averge Word length in The Sentence is',average
Re: Python Programming by jacob05(m): 4:16am On Dec 05, 2008
** Word count. A common utility on Unix/Linux systems is a small program called “wc.” This program analyzes a file to determine the number of lines, words, and characters contained therein. Write your own version of wc. The program should accept a file name as input and then print three numbers showing the count of lines, words, and characters in the file.

import os
def WC(file_location):
'The location of the file should be given correctly with exetension(.txt)'
if os.path.isfile(file_location)==False:print 'No file named as',file_location
if os.path.isfile(file_location)==True:
if os.path.splitext(file_location)[1].upper()[1:]=='TXT':
txt_file=open(file_location,'r')
text=txt_file.readlines()
txt_file.close()
line_counter=0
for line in text:
if line=='':
pass
else:
line_counter=line_counter + 1
print line_counter

text_in_string=''
for lines in text:text_in_string+=lines
text_in_string2=text_in_string.split()
word_counter=0
for word in text_in_string2:
word_counter=word_counter+1
print word_counter
num_characters=len(text_in_string)

print 'You Have',line_counter,'lines in',os.path.split(file_location)[1]
print 'You Have',word_counter,'words in',os.path.split(file_location)[1]
print 'You Have',num_characters,'characters in',os.path.split(file_location)[1]
else:
print 'TXT Files Only'


HOPE IT WORKS FOR YOU
THINK AM DONE EXCEPT FOR THE TWO QUESTIONS WHICH I DON'T UNDERSTAND IT WAS PHRASED undecided undecided
LET ME NOW HAVE A GOOD NIGHT REST
kiss
Re: Python Programming by Seun(m): 10:24pm On Dec 05, 2008
You wrote:

def AverageWord (sentence):
    words=sentence.split()
    len_words=len(words)
    if len_words==1:print 'You Just Entered a Word'
    else:
        total=0
        for i in range(0,len_words):
            total +=len(words[i])
        print total
        average=total/float(len_words)
        print 'The Averge Word length in The Sentence is',average

That is Java Programming in Python.  This is Python:

def AverageWord (sentence):
    words = sentence.split()
    wordlengths = [len(word) for word in words]
    averagelength = sum(wordlengths) / len(words)
    print "Average Length:", averagelength
Re: Python Programming by Seun(m): 10:57pm On Dec 05, 2008
I'm pretty sure the word count example can be simplified in the same way. Python is not Java. wink
Re: Python Programming by jacob05(m): 3:26pm On Dec 06, 2008
Yee! That is what i want to do before ooo BUT No regrets, am trying to be beginner friendly.



@bro Seun


Good Correction BUT i would have liked you code better if you had FLOAT it.
Re: Python Programming by jacob05(m): 9:23pm On Dec 06, 2008
@bro Seun
But You Can Make the code even more complicated using your code (remember[b] Python is not java[/b]) grin wink

def AverageWord (sentence):
    averagelength=round(float(sum([len(word) for word in sentence.split()]))/ len(sentence.split()))
    print "Average Length:", averagelength

Don't worry if the code is not readable or don't understand the code, Trying to differentiate JAVA from PYTHON wink grin

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (14) (Reply)

Meet Dare Obasanjo Who Works With Microsoft / Build A JAMB Result Checking Website To Win 150,000 Naira / Funny Programming Memes. Just For Laughs

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 97
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.