Jump to content

trying to be a lil hacker eh,

 

examples

def iif(condition,resultiftrue,resultiffalse):    if condition:return resultiftrue    else: return resultiffalse
  • x < y returns True iff x is strictly less than y.
  • x > y returns true iff x is strictly greater than y.
  • x <= y returns True iff x is less than or equal to y.
  • x >= y returns True iff x is greater than or equal to y.
  • x == y returns True iff x is equal to y.
  • x != y returns True iff x is not equal to y.

its just a term used in python really  uve got iff and ifs and iifs

 

Python uses lexicographic order and its bad to rely on floating point numbers

(◑‿◐)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5721828
Share on other sites

Link to post
Share on other sites

trying to be a lil hacker eh,

 

examples

def iif(condition,resultiftrue,resultiffalse):    if condition:return resultiftrue    else: return resultiffalse
  • x < y returns True iff x is strictly less than y.
  • x > y returns true iff x is strictly greater than y.
  • x <= y returns True iff x is less than or equal to y.
  • x >= y returns True iff x is greater than or equal to y.
  • x == y returns True iff x is equal to y.
  • x != y returns True iff x is not equal to y.

its just a term used in python really  uve got iff and ifs and iifs

 

Python uses lexicographic order and its bad to rely on floating point numbers

 

 

iff with the extra 'f' means "if and only if". https://en.wikipedia.org/wiki/If_and_only_if

Thank you both very much ! Now I can continue working :)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5721848
Share on other sites

Link to post
Share on other sites

Sorry to bother again, but is iff not recognized by Python but rather just an abbreviation for 'if used for instruction?

 

http://www.artofproblemsolving.com/wiki/index.php/Iff

 

( was already in my first post )

 

but thats all it to there on iff :P  try reading my first post and try understanding hehe, thats all there to it

(◑‿◐)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5721894
Share on other sites

Link to post
Share on other sites

dunno if this helps u but il post it for u anyway so u got an example of python rly, u dont need to force urself to use iffs instead of if ect

 

import optparse

parser = optparse.OptionParser('usage %prog -H'+\

'<target host> -p <targetport>')

parser.add_option(*-H*. dest='tgtHost'. type='string'. \

help='specify target host')

parser.add_option('-p'. dest='tgtPort'. type='int' . \

help='specify target port')

(options. args) = parser.parse_args()

tgtHost = options.tgtHost

tgtPort = options.tgtPort

if (tgtHost == None | {tgtPort == None}:

print parser.usage

exit(0)

(◑‿◐)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5721965
Share on other sites

Link to post
Share on other sites

dunno if this helps u but il post it for u anyway so u got an example of python rly, u dont need to force urself to use iffs instead of if ect

 

import optparse

parser = optparse.OptionParser('usage %prog -H'+\

'<target host> -p <targetport>')

parser.add_option(*-H*. dest='tgtHost'. type='string'. \

help='specify target host')

parser.add_option('-p'. dest='tgtPort'. type='int' . \

help='specify target port')

(options. args) = parser.parse_args()

tgtHost = options.tgtHost

tgtPort = options.tgtPort

if (tgtHost == None | {tgtPort == None}:

print parser.usage

exit(0)

Thank you!

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5721987
Share on other sites

Link to post
Share on other sites

trying to be a lil hacker eh,

 

go make those worms hahaha gl

 

Did I miss something? I thought this was an innocent question asking about the meaning of iff...

 

 

dunno if this helps u but il post it for u anyway so u got an example of python rly, u dont need to force urself to use iffs instead of if ect

...

 

Please use code tags when posting code. And just to add, optparse is deprecated since 2.7 and 3.2 so you should be using argparse instead if possible.

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5722308
Share on other sites

Link to post
Share on other sites

Did I miss something? I thought this was an innocent question asking about the meaning of iff...

 

 

 

Please use code tags when posting code. And just to add, optparse is deprecated since 2.7 and 3.2 so you should be using argparse instead if possible.

was just joking around a lil ofc( most ppl appreciate the jokes actually ;x ) :P

 

second i dont know any code tags from forums because i dont bother with forums normally this is basicly my first forum experience haha

(◑‿◐)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5722337
Share on other sites

Link to post
Share on other sites

second i dont know any code tags from forums because i dont bother with forums normally this is basicly my first forum experience haha

 

 

That's fine, just use them from now on as it makes code easier to read. It will format the text and uses some basic syntax highlighting.

# This is an exampleif x < 10:    print(x)else:    print("Not less than 10")

For really long pieces of code, it's best to also use spoiler tags or just link to the code uploaded somewhere else.

 

# A lot of code goes here...

 

Welcome to the forums :)

Link to comment
https://linustechtips.com/topic/426458-python-iff-help/#findComment-5722389
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×