我的代碼工作它創建了一個列表,然後同時採用「或」與「和」的條件做進一步的動作: a= ["john", "carlos", "22", "70"]
if (("qjohn" or "carlos") in a) and (("272" or "70") in a):
print "true"
else:
print "not true"
輸出: not true
我知道這是可能的: a, b = 5, 10
print 'a' if a > b else 'b' # outputs b
但是,如果我有另外一個變量 'C'?我如何使用與這兩個變量相同類型的邏輯在同一行中進行打印? 有點像? a, b, c = 5, 10, 20
print 'a' if a > b elif 'b' if b > c else 'c' # is it possibl
我創建了一個數據幀數據如下 name <- c("A","B","C","D","E","F","G","H","I","J")
age <- c(22,43,12,17,29,5,51,56,9,44)
sex <- c("M","F","M","M","M","F","F","M","F","F")
rock <- data.frame(name,age,sex,stringsAsFac