• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

python: what can i do with it

Joined
Nov 27, 2007
Messages
2,255 (0.38/day)
System Name HOMECOMPUTER
Processor Intel i9 - 9900k @ 5.1Ghz - 1.31v
Motherboard Asux ROG Maximus XI Hero Wifi
Cooling ek supremacy evo full nickle, 2xEK 360 Radiators, ek d5 pump/res combo, ek full cover 2080ti block
Memory 16GB DDR 3600 Trident Z RGB
Video Card(s) Gigabyte RTX 2080TI
Storage 1xWD black NVME 500GB, 1xSamsung 970 Evo Plus NVME 1TB
Display(s) 2 Dell Gaming 27" 1440P Gsync
Case Lian LI PC-011 Dynamic
Audio Device(s) onboard
Power Supply Evga P2 1200Watt
Mouse Zowie FK1+
Keyboard Corsair Strafe rgb silent
Software Windows 10 Pro
Benchmark Scores i'm working on that
My girlfriends brother is a software engineer and i asked him about learning a programming language and he said that python was a pretty good place to start... i found some guides online that seem easy enough to follow but the problem i'm having is... what is it good for??

can anybody post some code they found or wrote for python 2 so i can see some examples of written code??
 
Joined
Sep 24, 2008
Messages
2,665 (0.47/day)
System Name Dire Wolf IV
Processor Intel Core i9 14900K
Motherboard Asus ROG STRIX Z790-I GAMING WIFI
Cooling Arctic Liquid Freezer II 280
Memory 2x24GB Corsair DDR5 6667
Video Card(s) NVIDIA RTX4080 FE
Storage AORUS Gen4 7300 1TB + Western Digital SN750 500GB
Display(s) Alienware AW3423DWF (QD-OLED, 3440x1440, 165hz)
Case Corsair Airflow 2000D
Power Supply Corsair SF1000L
Mouse Razer Deathadder Essential
Keyboard Chuangquan CQ84
Software Windows 11 Professional
My girlfriends brother is a software engineer and i asked him about learning a programming language and he said that python was a pretty good place to start... i found some guides online that seem easy enough to follow but the problem i'm having is... what is it good for??

can anybody post some code they found or wrote for python 2 so i can see some examples of written code??

I am currently running an experiment on Planetlab which is doing measurements of some things over the internet, and the code is written entirely in Python. I started coding in the language a very short while ago and it is indeed very simple and very easy to learn and comes with a very powerful library of tools (You have built-in code to do things like MD5 checksum calculations, working with ZIP archive files, and so on).

It can do just about anything you throw at it, including even things like basic 3D graphics by using Python libraries which interact with OpenGL.

I cannot provide examples of my code, for obvious reasons, and I gotta run to work, so I cannot find you anything very interesting as code examples off the web.

In general - Just about any shell (non-GUI) application you can think of, or can find on the web, written in any other language, can most likely be written in Python. As a scripting language, it is especially comfortable to use for file and text manipulation, or for the creation of small but helpful applications, such as this little bit of code generating random passwords for admins.
 

unibrow1990

New Member
Joined
Mar 19, 2009
Messages
194 (0.04/day)
Location
Detroit, Michigan
System Name FUBAR
Processor AMD Phenom II 720BE @ 3.6Ghz
Motherboard Jetway HA06, 780g sb700
Cooling Sunbeamtech Core Contact Freezer, 2x 40mm fan 1x 70mm hdd fan, 2x 80mm case fans, 4x 120mm case fans
Memory 4gb OCZ Reaper ddr2 800@ 4-4-4-12-1t 2.2v
Video Card(s) HIS 4850 ICEQ4 512mb crossfired with XFX 4850 512mb
Storage WDC Black 640gb SATA, 250gb Hitachi Deskstar SATA
Display(s) Acer X193W+ 19" 5ms 1680x1050
Case Modded Raidmax Smilodon Extreme Black
Audio Device(s) Integrated W/ Altec Lansing 2.1 speakers
Power Supply Rosewill RP550V2-D-SL 550W with FSP Booster X3
Software Win 7 Home Premium 64-bit
Python is a great programming language to start learning in. It is the first language I learned to program in and while I have now found other languages I like better for everyday programming I think python is the best place to start.

Python is a general purpose programming language, so it is good for really anything, The only area where it struggles is in some computationally intense programs, because it is an interpreted rather than a com piled language and there fore slower to execute. This slowness is indistinguishable in everyday applications though.

I will post some python programs that I have written in a little bit(I have to change the code from 3.x to 2.x)
 

unibrow1990

New Member
Joined
Mar 19, 2009
Messages
194 (0.04/day)
Location
Detroit, Michigan
System Name FUBAR
Processor AMD Phenom II 720BE @ 3.6Ghz
Motherboard Jetway HA06, 780g sb700
Cooling Sunbeamtech Core Contact Freezer, 2x 40mm fan 1x 70mm hdd fan, 2x 80mm case fans, 4x 120mm case fans
Memory 4gb OCZ Reaper ddr2 800@ 4-4-4-12-1t 2.2v
Video Card(s) HIS 4850 ICEQ4 512mb crossfired with XFX 4850 512mb
Storage WDC Black 640gb SATA, 250gb Hitachi Deskstar SATA
Display(s) Acer X193W+ 19" 5ms 1680x1050
Case Modded Raidmax Smilodon Extreme Black
Audio Device(s) Integrated W/ Altec Lansing 2.1 speakers
Power Supply Rosewill RP550V2-D-SL 550W with FSP Booster X3
Software Win 7 Home Premium 64-bit
As promised here are some things I've written in python at various dates, I tried to confine it to more well written things that do some different actions.

Included:

GUI apps - A couple GUI apps I wrote that run scripted events out a parallel port, my friend used them with a circuit he built to make fireworks shows.

Quiz game - A simple Quiz game I wrote, includes an app that makes a default quiz and one that lets you write new quizzes.

Simple number game - A good one to look at to start,i its a simple Higher.lower number guessing game.

Working with files - An addition I wrote for a friends WoW module that demonstrates working with files and widows commands.

Hopes these help.
 

Attachments

  • sample.zip
    14.6 KB · Views: 211

regexorcist

New Member
Joined
Feb 1, 2010
Messages
178 (0.03/day)
Location
~/
System Name Slackware Linux
Processor yes
Motherboard yes
Cooling currently convection, but considering mineral oil
Memory sometimes fails due to too much beer
Video Card(s) ATI Radeon HD5570 series
Storage IDE
Display(s) 32" LCD TV
Case sometimes
Audio Device(s) huh? what? speak up, I can't hear you
Power Supply yes
Software Slackware running Open-Source software (it doesn't get any better)
Python is awesome and easy to learn.
An execllent choice for a first language.
Multi-platform
Object Oriented
Forced indenting (creates good habits)
Fairly high-level so you don't get frustrated with low level details

Best of all, it's named after Monty Python :D
Good Choice, you should thank him!!
 

regexorcist

New Member
Joined
Feb 1, 2010
Messages
178 (0.03/day)
Location
~/
System Name Slackware Linux
Processor yes
Motherboard yes
Cooling currently convection, but considering mineral oil
Memory sometimes fails due to too much beer
Video Card(s) ATI Radeon HD5570 series
Storage IDE
Display(s) 32" LCD TV
Case sometimes
Audio Device(s) huh? what? speak up, I can't hear you
Power Supply yes
Software Slackware running Open-Source software (it doesn't get any better)
What can Python do???

This simple python script shows how many times
certain numbers came up in the NJ Cash5 Lottery.

It goes online and compares against the historical archive of winning numbers.

Code:
#!/usr/bin/python

import re
import urllib

lotto_link = 'http://www.state.nj.us/lottery/games/1-3-2_jc5_history_pfv.shtml'
my_numbers = ('01','02','03','04','05')

draw_numbers = ''
my_matches = []

file_handle = urllib.urlopen(lotto_link)

print 'Drawing Date   Winning Numbers   Numbers I Matched'
print '------------   ---------------   -----------------'

for file_row in file_handle.readlines():

  if file_row.startswith('        <tr><td valign="top" align="center">') \
  or file_row.startswith('<tr><td valign="top" align="center">'):
    
    draw_date = file_row.strip(' ')[36:46]
    draw_numbers = file_row.strip(' ')[83:97]

    my_matches = []

    for loop_count in range(0,4):
      if re.search(my_numbers[loop_count], draw_numbers):
        my_matches.append(my_numbers[loop_count])
          
    print draw_date,'   ',draw_numbers,'  ', my_matches

file_handle.close()

What can Python do?

Python can help you win the lottery :laugh: :rockout:
 

regexorcist

New Member
Joined
Feb 1, 2010
Messages
178 (0.03/day)
Location
~/
System Name Slackware Linux
Processor yes
Motherboard yes
Cooling currently convection, but considering mineral oil
Memory sometimes fails due to too much beer
Video Card(s) ATI Radeon HD5570 series
Storage IDE
Display(s) 32" LCD TV
Case sometimes
Audio Device(s) huh? what? speak up, I can't hear you
Power Supply yes
Software Slackware running Open-Source software (it doesn't get any better)
As promised here are some things I've written in python at various dates, I tried to confine it to more well written things that do some different actions.

Included:

GUI apps - A couple GUI apps I wrote that run scripted events out a parallel port, my friend used them with a circuit he built to make fireworks shows.

Quiz game - A simple Quiz game I wrote, includes an app that makes a default quiz and one that lets you write new quizzes.

Simple number game - A good one to look at to start,i its a simple Higher.lower number guessing game.

Working with files - An addition I wrote for a friends WoW module that demonstrates working with files and widows commands.

Hopes these help.
Thanks for the apps, I finally got around to downloading "unzip" for linux
so I could get at them. :)

(had to tweak things a bit)
Good Stuff :D
THANKS!!

Have you played around w/ Python3 yet?
 
Joined
Jun 24, 2009
Messages
230 (0.04/day)
Location
Chicago
System Name Achilleus
Processor Intel Core i7 4770k
Motherboard GIGABYTE Z87N-WIFI
Memory Patriot Intel Extreme Masters Viper 3 2133MHz (2x4GB)
Video Card(s) EVGA GTX 970
Storage 2x Intel X25-M 160GB, 2x WD Caviar Black 1TB in RAID 1
Display(s) LG 29UB65-P
Case Bitfenix Prodigy
Power Supply PCP&C Silencer MK III 600W
Software Win7 Professional x64
here are some programs i wrote when learning python, mostly basic python but also some cython and c extensions with the python api. don't remember exactly what all the programs are, i do know there's a maze builder and solver using classes. i'm sure i can dig up more, i can also get some tutorials and snippets i've written for anyone interested.
 

Attachments

  • python programs.zip
    55.3 KB · Views: 231

regexorcist

New Member
Joined
Feb 1, 2010
Messages
178 (0.03/day)
Location
~/
System Name Slackware Linux
Processor yes
Motherboard yes
Cooling currently convection, but considering mineral oil
Memory sometimes fails due to too much beer
Video Card(s) ATI Radeon HD5570 series
Storage IDE
Display(s) 32" LCD TV
Case sometimes
Audio Device(s) huh? what? speak up, I can't hear you
Power Supply yes
Software Slackware running Open-Source software (it doesn't get any better)
Hi parelem,
How unusual, tarballs inside of a pk/win zip file :laugh:

I opened one of your tarballs and found the Golden Search.
I've never used that, but it reminds me of the Fibonacci search
which reminds me of school and now my head is hurting. :shadedshu

And now that I'm thinking of school, I'm going to have a BEER :toast:

I'll get around to opening the rest of the tarballs soon
Good Stuff parelem (maybe a little too advanced for me :D)
 
Joined
Jun 24, 2009
Messages
230 (0.04/day)
Location
Chicago
System Name Achilleus
Processor Intel Core i7 4770k
Motherboard GIGABYTE Z87N-WIFI
Memory Patriot Intel Extreme Masters Viper 3 2133MHz (2x4GB)
Video Card(s) EVGA GTX 970
Storage 2x Intel X25-M 160GB, 2x WD Caviar Black 1TB in RAID 1
Display(s) LG 29UB65-P
Case Bitfenix Prodigy
Power Supply PCP&C Silencer MK III 600W
Software Win7 Professional x64
yeah, that golden section search was "fun" to say the least. the "275" labeled programs are more complex than the "mp" ones, i'll see what else i can find. if you have any questions regarding my files or python in general, feel free to ask.
 
Top