New Posts  All Forums:Forum Nav:

Python help - Page 2

post #11 of 21
I just noticed... {Unregistered} 's code doesn't convert the string to an int before trying to do the compare biggrin.gif so it errors... I take my glasses off in your direction now sir rolleyes.gif




(and mine has zero error checking and as such is not good for production level code... FYI)
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
post #12 of 21
Why would I need to convert an int into an int again? rolleyes.gif
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #13 of 21
the error I get when i run your suggestion says that variableOne isn't an int...
Edited by CrashZero - 8/31/12 at 9:35am
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
post #14 of 21
I derped. redface.gif

Python 3 onward removed separate input() and raw_input() functions. The former used to take an int as input and the latter took input as a String.
I was working on Python 2.7.2 so didn't realise this.

Yes, you guys are correct in saying that input() takes input as a String, in Python 3.
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #15 of 21
Quote:
Originally Posted by {Unregistered} View Post

I derped. redface.gif


happens to everyone from time to time..
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
post #16 of 21
Thread Starter 
Quote:
Originally Posted by CrashZero View Post

Quote:
Originally Posted by White Fire View Post

That only raised errors for me -.-

what version of python are you running?

(i just ran it and it worked as expected...)
3.2.3
Red Thunder
(19 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k ASRock Fatal1ty Z68 Pro3 Gen3 Diamond Multimedia HD 5970 G.Skill Ripjaws X 8GB 
Hard DriveHard DriveOptical DriveCooling
OCZ Solid 3 60GB Seagate Barracuda 7200.9 160GB Lite-On iHAS424 Sunbeam Twister 120 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Samsung SyncMaster E1920X Logitech K120 Corsair GS700 
CaseMouseMouse PadAudio
NZXT Phantom Razer Naga None Realtek ALC892 
OtherOtherOther
Behringer Xenyx 502 Lepai LP-2020A+ Dayton Audio B652 
  hide details  
Reply
Red Thunder
(19 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k ASRock Fatal1ty Z68 Pro3 Gen3 Diamond Multimedia HD 5970 G.Skill Ripjaws X 8GB 
Hard DriveHard DriveOptical DriveCooling
OCZ Solid 3 60GB Seagate Barracuda 7200.9 160GB Lite-On iHAS424 Sunbeam Twister 120 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Samsung SyncMaster E1920X Logitech K120 Corsair GS700 
CaseMouseMouse PadAudio
NZXT Phantom Razer Naga None Realtek ALC892 
OtherOtherOther
Behringer Xenyx 502 Lepai LP-2020A+ Dayton Audio B652 
  hide details  
Reply
post #17 of 21
Well, technically, you guys derped as much as I did. tongue.gif

And I think Python 3 isn't as popular anyway, but I'll have to keep these changes in mind from now on.
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #18 of 21
I might possibly have used two different versions while I tested it too...oops:o.
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
First WC, epic
(10 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 3930K RAMPAGE IV EXTREME NVIDIA GeForce GTX 670 NVIDIA GeForce GTX 670 
RAMRAMRAMRAM
Corsair  Corsair  Corsair  Corsair  
RAMHard Drive
Corsair  Crucial M4 
  hide details  
Reply
post #19 of 21
My biggest Complaint about 3.2.3 is that print statements need more typing now.

for example:

2.7.3
Code:
print 'hi'

3.2.3
Code:
print ('hi')

Not the biggest thing in the world, but overall I prefer 3.2.3 over my previous 2.7.3.
Bob's Computer
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 2500K MSI P67A-G45 MSI 6970 Lightning 2GB G Skill Ripjaws X (2x4GB) 1866mhz 9-10-9-28 
Hard DriveOptical DriveCoolingOS
Corsair Force 3 SSD (60GB), X1 WD5000AAKS, X1 W... ASUS DRW-24B1ST/BLK/B/AS Black SATA 24X DVD Burner Noctua NH-C14 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Logitech G510 HALE90 750W NZXT Phantom Black 
MouseMouse PadAudioOther
Logitech G9x SteelSeries 4HD ASUS Xonar DGX / Audio-Technica ATH-AD700 Hauppauge! HVR-1250 TV Tuner 
  hide details  
Reply
Bob's Computer
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 2500K MSI P67A-G45 MSI 6970 Lightning 2GB G Skill Ripjaws X (2x4GB) 1866mhz 9-10-9-28 
Hard DriveOptical DriveCoolingOS
Corsair Force 3 SSD (60GB), X1 WD5000AAKS, X1 W... ASUS DRW-24B1ST/BLK/B/AS Black SATA 24X DVD Burner Noctua NH-C14 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Logitech G510 HALE90 750W NZXT Phantom Black 
MouseMouse PadAudioOther
Logitech G9x SteelSeries 4HD ASUS Xonar DGX / Audio-Technica ATH-AD700 Hauppauge! HVR-1250 TV Tuner 
  hide details  
Reply
post #20 of 21
Quote:
Originally Posted by Bobicon View Post

My biggest Complaint about 3.2.3 is that print statements need more typing now.
for example:
2.7.3
Code:
print 'hi'
3.2.3
Code:
print ('hi')
Not the biggest thing in the world, but overall I prefer 3.2.3 over my previous 2.7.3.

I actually like the change that you just pointed out.
print() is supposed to be a function, so it should logically require a pair of parentheses after it, to include the arguments. Even in Python 2.7, I use the parentheses anyway.
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming