Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Need someone to mentor me

They are used for formatting strings. %d acts as a placeholder for a number %s used for a placeholder in a string
***********SORRY""""""this this this this this this this


Are you still looking for someone. If so can you PM me. I am unable to do so yet.
(Mar 1, 2017 08:35 AM)(╯°□°)╯︵ ┻━━┻ Wrote:  Python 2 has print as a statement where Python 3 has print as a function (the parentheses).

I wanted to elaborate on this, this is a 100% correct answer in case specifically for print, but I wanted to answer it more broadly. I'd also like to say that IMO print should always be used as a function unless you're in a specific environment where you can't so it's interchangeable.

Anyways, () refers to calling a function, print in python2 is not a function it's a statement. Lets say we refer to a function but don't call it like

Code
def func(x):
    return x

test = func

This alone won't execute the function but

Code
def func(x):
    return x

test = func

test()

will.

We can go on to do fun things like

Code
def handleChoiceOne():
    return 'choice one'

def handleChoiceTwo():
    print('choice two')

funcDict = {
    'userChoiceOne': handleChoiceOne,
    'userChoiceTwo': handleChoiceTwo,
}

userChoice = raw_input(' : ')
funcDict[userChoice]() #not here how we are executing a function and refering to it through a dict


Also OP, if you want an immediate answer I'm usually available skype: live:obnoxious_16
go to places like Udemy (warez disallowed).com . its not exactly mentoring, but the classes are pretty good. I am also learning python