School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,422 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,529 people online right now. Registration is fast and FREE... Join Now!




How do i get the first number out of a list of two numbers?

 

How do i get the first number out of a list of two numbers?

xZachtmx

14 Jun, 2009 - 04:30 AM
Post #1

New D.I.C Head
*

Joined: 14 Jun, 2009
Posts: 38



Thanked: 1 times
My Contributions
First of all... this is called a tuple right: 1024,768 ? tongue.gif

Ok now for my main question.

How do i get a number list like this
windowSize = 1024,768

and then set a variable that is equal to the first number and then another that is the second number in that list?

Thanks guys smile.gif

User is offlineProfile CardPM
+Quote Post


shadhin

RE: How Do I Get The First Number Out Of A List Of Two Numbers?

14 Jun, 2009 - 05:39 AM
Post #2

D.I.C Regular
Group Icon

Joined: 16 Sep, 2008
Posts: 421



Thanked: 19 times
Dream Kudos: 3650
My Contributions
Both list and tuple are data structures you can use for this purpose-

Use list like this-
CODE

windowSize=[1024,768]


and tuple-
CODE

windowSize=(1024,768)


Then you can recall it by-
CODE

windowSize[0]
windowSize[1]

User is offlineProfile CardPM
+Quote Post

xZachtmx

RE: How Do I Get The First Number Out Of A List Of Two Numbers?

14 Jun, 2009 - 05:49 AM
Post #3

New D.I.C Head
*

Joined: 14 Jun, 2009
Posts: 38



Thanked: 1 times
My Contributions
Just what i needed thanks so much!!!
User is offlineProfile CardPM
+Quote Post

shadhin

RE: How Do I Get The First Number Out Of A List Of Two Numbers?

14 Jun, 2009 - 07:05 AM
Post #4

D.I.C Regular
Group Icon

Joined: 16 Sep, 2008
Posts: 421



Thanked: 19 times
Dream Kudos: 3650
My Contributions
Nice to know that. Hope to see you around the forum many times...
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:11AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month