Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Python Beginners Tutorial | 3 | filter_list
Author
Message
Python Beginners Tutorial | 3 | #1
[Image: attachment-0001.png]
[Image: tqpbe.png]

Hello, and welcome AF,

Sorry for not been posting that much as i maybe told Wink

Have been some things at school and etc, but now im back :blackhat:

So, today well be covering a few more things related to lists and much more so lets begin.


Last time we created a list right? with the simple command:

listname = [1,4,5,6,7,8,9,10]


And we went through how it counts, it starts at 0 not at 1.

And today, i will show you a new one called a 'Tuple' a tuple is basically the same thing as a list, the only difference is that you cant do a s'it with the tuples, the only thing you can use them for is to call the values back, so how do we create a tuple? Well, its fairly easy:

slu=(5,376,65,267,984)


And then we have our tuple, how do you recall the command? Well with the same as with the lists:

slu[2]

Will give back 65. So, what can you use these for? Maybe a game were the different damage values are saved in a tuple and printed out when the "slu[2]" command is executed? I dont know Wink Since you cant change in the "tuple", so there arent that many things you can use them for, well that's my opinion.

Anyways, lets move on.

A few commands you can use for your lists:

Code:
len(listname)
Will give you the lenght of the list.

Code:
max(listname)
Will give you the biggest number in the list.

Code:
min(listname)

I think you know what is means Wink

And then one of the more useful commands, the 'list'

its used like this:

Code:
list('string or name/word, number etc')

It will then make a list of the word string or whatever you entered, please try it in the Shell Smile

Im sorry this isn't maybe the best and most good-looking tutorial so far, but ive thought about one thing, and i think i will start with making video tutorials instead of writing them down, since it doesnt take that alot of time to just render and explain than it takes to write things down, if some of you dont like it or want me to do another way, please let me know.

And ofc i will let you have the codes for every episode, so you wont miss anything Wink

Well, so i think thats everything for today. Please check out my next thread, I will be posting some, maybe great stuff for some of you on that one.

To the next meet, please have a good time! :blackhat:
(This post was last modified: 10-02-2012, 06:01 PM by SLUAST.)
[Image: attachment-0001.png]

Reply

RE: Python Beginners Tutorial | 3 | #2
great tutorial, but you have to use / on the apposing code bb codes

example

[code]
[ / code] - remove the spaces
[Image: hZbv6.gif]

Reply

RE: Python Beginners Tutorial | 3 | #3
You should include how to run your scripts on Linux and how to
edit them. If you don't have access to Linux then I may cover it
soon enough as it's pretty basic stuff.
(This post was last modified: 10-02-2012, 07:03 PM by Jewel.)

Reply

RE: Python Beginners Tutorial | 3 | #4
Well, I don't currently have that time man, but it would be awesome if you could do that Smile
[Image: attachment-0001.png]

Reply







Users browsing this thread: 2 Guest(s)