Overclock.net - An Overclocking Community - View Single Post - What is this? Not a string..

View Single Post
post #29 of (permalink) Old 11-04-2018, 08:39 AM - Thread Starter
New to Overclock.net
PhotonFanatic's Avatar
Join Date: Dec 2009
Posts: 1,878
Rep: 19 (Unique: 18)
Quote: Originally Posted by spinFX View Post
Anything can equal anything depending on how they are compared. A string is a combination of chars. A char has an int value. Therefore each letter has a numeric value and a string can have a numeric value.
Ah thank you I didn't think of it that way. Is the numeric value the same as the index? So the numeric value of each character in "Cheeseburger" would correspond to the index. Or are there other numbers assigned to each character somehow? I guess that wouldn't really work. It would get confused when you have more than one of the same letter. I have never seen these numbers which are assigned to strings. Anti_clockwise posted them but where are they actually located? Some module in python they are being drawn from?

And here is another question for today. I don't get where animal came from, as opposed to animals. To me, animal seems to appear out of nowhere. It was never assigned anything.

animals = ["cat", "ant", "bat"]

for animal in animals:
  print animal

"Executing execution.exe"
Bang for the buck
(12 items)
3570k @ 4.6Ghz @1.35v
Gigabyte Z77x UD3H
evga GTX 970 SSC
16Gb Gskill Ripjaws 2133Mhz @ 9-11-10-28
Hard Drive
Samsung Evo 850
Power Supply
Silverstone 900 watt
Thermalright Ultra 120 Extreme
Silverstone Raven (1st edition)
Operating System
Windows 10 Spy Delux
Xstar 27" PLS 1440p
Wireless ergonomic
Logisys Wireless trackball
▲ hide details ▲
PhotonFanatic is offline