Exforsys

Online Training

Can some one show me some Python coding

This is a discussion on Can some one show me some Python coding within the Python forums, part of the Programming Talk category; It is a little stupid question but can some one show me some Python coding I have never seen it ...


Go Back   Exforsys > Programming Talk > Python

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-23-2006, 02:36 PM
Junior Member
 
Join Date: Apr 2006
Posts: 19
MadKad is on a distinguished road
Can some one show me some Python coding

It is a little stupid question but can some one show me some Python coding I have never seen it and have noticed that people dont really use it well what I can, so what use does it have?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-23-2006, 02:44 PM
iatbm's Avatar
Member
 
Join Date: Apr 2006
Posts: 51
iatbm is on a distinguished road
check out this thread http://www.exforsys.com/forum/python...-solution.html (I found great solution for Python...)

Otherwise google uses python for their services and search engine so it is quite powerfull
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-23-2006, 02:59 PM
Junior Member
 
Join Date: Apr 2006
Posts: 19
MadKad is on a distinguished road
no way do google use it I never noticed what file forumat does it use?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-23-2006, 05:15 PM
iatbm's Avatar
Member
 
Join Date: Apr 2006
Posts: 51
iatbm is on a distinguished road
Why are they hiring so much python programmers then

Just for the proof http://www.google.com/support/bin/topic.py?topic=367

see that little .py at the end
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-24-2006, 06:08 AM
Junior Member
 
Join Date: Apr 2006
Posts: 19
MadKad is on a distinguished road
are right so .py is the file format thank you

I am still looking to see what some of the code looks like lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-24-2006, 07:32 AM
iatbm's Avatar
Member
 
Join Date: Apr 2006
Posts: 51
iatbm is on a distinguished road
This is the thing you need




# a selection of simple Python code to give you a taste of the language ...
#
# Just a few notes about Python:
# Python has a very efficient built-in memory manager.
# Python does not need variable types declared, it is smart enough to figure that out!
# Python uses whitespaces to group statements, this avoids the begin/ends and {}
# of other languages. Let's face it, you use whitespaces anyway in these
# languages to make the code more readable! In other words, Python forces you
# to make code more readable. You get used to the indentations naturally.
# Use the number of spaces you like, the de facto standard is four spaces.
# Important caveat:
# keep the spacing uniform for the group of statements
# that belong together, and don't mix tabs and spaces. Avoid tabs!
#
# I used Python-2.3.4.exe (the Windows installer package for Python23)
# from http://www.python.org/2.3.4/
# code tested with Python23 vegaseat 16jan2005


print "Simple math like 12345679*63 = ", 12345679*63

# print just an empty line
print

# display numbers 0 to 9
# the indentation before print makes it part of the loop
for number in range(10):
print number

# print also adds a newline, use a comma to prevent the newline
for number in range(10):
print number,

print

# import the math module for the sqrt() function
import math

# a little more complex this time
# \n is the newline character, % starts the format specifier
# Python does have its roots in the C language
# notice how we use the sqrt() function from the math module
# CYA: more specifically, sqrt() is a function in module math
print "\nSquare root of integers 0 to 9 formatted as a float with 4 decimals:"
for value in range(10):
squareRoot = math.sqrt(value)
print "sqrt(%d) = %.4f" % (value, squareRoot)

# now it gets a bit more hairy
print "\nDisplay integers 0 to 15 formatted to use 6 spaces ..."
print "(plain, zero-padded, hex and octal)"
print " %s %s %s %s" % ('%6d', '%06d', '%6x', '%6o')
for value in range(16):
print "%6d %06d %6x %6o" % (value, value, value, value)

print

print "\nA not so typical for loop:"
for food in "spam", "eggs", "cumquats":
print "I love", food

print

# a short intro to string slicing
# a little cryptic at first blush, but very powerful
# [begin : < end : step] end is exclusive, step is optional
# defaults are index begin = 0, index end = length, step = 1
animal = "hippopotamus"
print "this is the string = ", animal
print "length of string = ", len(animal)
print "exclude first 3 char = ", animal[3: ]
print "exclude last 4 char = ", animal[:-4]
print "reverse the string = ", animal[::-1]

# define/create a function
# the indented lines are part of the function
def convertFahrenheit2Celsius(fahrenheit):
celcius = 0.555 * (fahrenheit - 32)
return celcius

print

# and use the function
# (make sure you define/create the function before you call it)
print "A Fahrenheit to Celcius table:"
# range is from -40 to < 220 in steps of 10
for tf in range(-40, 220, 10):
print "%5.1fF = %5.1fC" % ( tf, convertFahrenheit2Celsius(tf) )

print

print "A limited set:"
# another variation of the for loop
for tf in -40,0,32,98.6:
print "%5.1fF = %5.1fC" % ( tf, convertFahrenheit2Celsius(tf) )

print

# test boolean results
print "Is 3 > 5? Result =", 3 > 5 # result = False
print "Is 3 < 5? Result =", 3 < 5 # result = True

# optional wait for keypress
raw_input('Press Enter...')
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-24-2006, 08:52 AM
Junior Member
 
Join Date: Apr 2006
Posts: 19
MadKad is on a distinguished road
:S that looks fun thank you for showing me

I have to say it looks a little like php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-30-2006, 11:51 AM
Mount Tropolis's Avatar
Broke with Money
 
Join Date: Apr 2006
Location: Bronx, NY
Posts: 6
Mount Tropolis is on a distinguished road
Send a message via AIM to Mount Tropolis Send a message via MSN to Mount Tropolis
What does a PYTHON file do anyway? I am very confused here
__________________
http://www.Paypal.com/
Go ahead and dontate to Mount.Tropolis@Gmail.com any amount WILL do!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-30-2006, 11:56 AM
Member
 
Join Date: Apr 2006
Posts: 98
Angela is on a distinguished road
Business Reasons for Using Python

is it like C language.... ANy business reasons for using Python opposed to other programming launguages...

Please some one clear by doubts...

Thanks,
Angela
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
I found great solution for Python... iatbm Python 3 05-13-2006 09:18 PM
Python script problem Zarooka Python 1 04-20-2006 07:46 PM
Windows Vista : The .NET Show: Management Services techguru Windows Vista Tutorials 0 08-27-2005 02:00 AM
Testing engineers on perl / python / TCL techguru Experienced Job Seekers - India 0 05-21-2005 08:11 AM
coding doubt sudhap Visual Basic Tutorials 1 01-26-2005 10:40 PM


All times are GMT -4. The time now is 04:15 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.