![]() |
|
My first Program - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Python (https://sinister.li/Forum-Python) +--- Thread: My first Program (/Thread-My-first-Program) Pages:
1
2
|
My first Program - BlueCat - 06-18-2014 Here is my First Program. Basically all it does it Shuffles a deck of cards, an easy beginner program. any suggestions on how I could improve it? Thanks to @Ex094 for his awesome beginners Python tutorial! source included. Code: #Program created by Root@LocalHost
#Thanks to Exo94 for his awesome python help
#This program will shuffle a deck of cards
import itertools, random
#here is the deck of cards, Call them whatever you like.
deck = list(itertools.product(range(1,14), ['spade', 'heart', 'diamond', 'club']))
#this bit will shuffle the deck of cards
random.shuffle(deck)
#This will draw(how many cards you like)
print('You got:')
for i in range(3):
print(deck[i][0], "of", deck[i][1])RE: My first Program - Ex094 - 06-18-2014 Glad to see you are making progress Hook me up with a PM if ya need any further help..
RE: My first Program - BlueCat - 06-18-2014 (06-18-2014, 03:04 PM)Ex094 Wrote: Glad to see you are making progress Do you any ideas on how I can take this project a step further? As at the moment it is very dull and thank-you mile:
RE: My first Program - Ex094 - 06-18-2014 (06-18-2014, 03:05 PM)root@localhost Wrote:(06-18-2014, 03:04 PM)Ex094 Wrote: Glad to see you are making progress I can't give you any tips on this small script since it's operation is limited but you can make a card game RE: My first Program - BlueCat - 06-18-2014 (06-18-2014, 03:14 PM)Ex094 Wrote:(06-18-2014, 03:05 PM)root@localhost Wrote:(06-18-2014, 03:04 PM)Ex094 Wrote: Glad to see you are making progress Since python supports sockets I am going to attempt to create a tiny port scanner mile: I was wondering if you could create me some text art for it?
RE: My first Program - Anima Templi - 06-18-2014 Text art, for a port scanner? I'd put more focus into the actual functioning of your project, than the interface A port scanner is a simple task, I did it in less than 60 lines of code, with error handling. Let me know if you hit any walls. RE: My first Program - Ex094 - 06-18-2014 (06-18-2014, 03:26 PM)root@localhost Wrote:(06-18-2014, 03:14 PM)Ex094 Wrote:(06-18-2014, 03:05 PM)root@localhost Wrote:(06-18-2014, 03:04 PM)Ex094 Wrote: Glad to see you are making progress I don't wanna discourage you but there are lots of port scanners out there, Be Creative and think out of the box I am not saying don't make it, just saying that use your imagination and create something better. If you like PM me and I'll give you some heads up
RE: My first Program - BlueCat - 06-18-2014 (06-18-2014, 03:33 PM)Anima Templi Wrote: Text art, for a port scanner? I'd put more focus into the actual functioning of your project, than the interface Thanks man! RE: My first Program - L0aD1nG - 06-20-2014 This is a version of your program with a prettier print out ![]() Check it out.. Code: import itertools, random
#here is the deck of cards, Call them whatever you like.
deck = list(itertools.product(range(1,14), ['spade', 'heart', 'diamond', 'club']))
#this bit will shuffle the deck of cards
random.shuffle(deck)
#This will draw(how many cards you like)
print('You got:')
for i in range(3):
print("{:<2} {:<2} {:<10}".format(str(deck[i][0]),"of",str(deck[i][1])))(06-18-2014, 03:33 PM)Anima Templi Wrote: Text art, for a port scanner? I'd put more focus into the actual functioning of your project, than the interface You used python-nmap library to do it dude or just with the socket module? RE: My first Program - Anima Templi - 06-20-2014 I used sockets. |