“or” conditional in Python troubles [duplicate]

Boolean expressions in most programming languages don’t follow the same grammar rules as English. You have to do separate comparisons with each string, and connect them with or: if x == “monkey” or x == “monkeys”: print “You’re right, they are awesome!!” else: print “I’m sorry, you’re incorrect.”, x[0].upper() + x[1:], “is not the right … Read more

Using conditional statements inside ‘expect’

Have to recomment the Exploring Expect book for all expect programmers — invaluable. I’ve rewritten your code: (untested) proc login {user pass} { expect “login:” send “$user\r” expect “password:” send “$pass\r” } set username spongebob set passwords {squarepants rhombuspants} set index 0 spawn telnet 192.168.40.100 login $username [lindex $passwords $index] expect { “login incorrect” { … Read more

Greater Than Condition in Linq Join

You can’t do that with a LINQ joins – LINQ only supports equijoins. However, you can do this: var query = from e in entity.M_Employee from p in entity.M_Position where e.PostionId >= p.PositionId select p; Or a slightly alternative but equivalent approach: var query = entity.M_Employee .SelectMany(e => entity.M_Position .Where(p => e.PostionId >= p.PositionId));