亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? node12.html

?? Pythone Library reference. it is ok and simple.
?? HTML
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0062)http://www.honors.montana.edu/~jjc/easytut/easytut/node12.html -->
<!--Converted with LaTeX2HTML 99.2beta6 (1.42)original version by:  Nikos Drakos, CBLU, University of Leeds* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from:  Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>Boolean Expressions</TITLE>
<META content="Boolean Expressions" name=description>
<META content=easytut name=keywords>
<META content=document name=resource-type>
<META content=global name=distribution>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<META content=text/css http-equiv=Content-Style-Type><LINK 
href="node12_files/easytut.css" rel=STYLESHEET><LINK href="node13.html" 
rel=next><LINK href="node11.html" rel=previous><LINK href="easytut.html" 
rel=up><LINK href="node13.html" rel=next></HEAD>
<BODY><!--Navigation Panel--><A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node13.html" 
name=tex2html304><IMG align=bottom alt=next border=0 height=24 
src="node12_files/next.png" width=37></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html" 
name=tex2html300><IMG align=bottom alt=up border=0 height=24 
src="node12_files/up.png" width=26></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node11.html" 
name=tex2html294><IMG align=bottom alt=previous border=0 height=24 
src="node12_files/prev.png" width=63></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node2.html" 
name=tex2html302><IMG align=bottom alt=contents border=0 height=24 
src="node12_files/contents.png" width=65></A> <BR><B>Next:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node13.html" 
name=tex2html305>Dictionaries</A> <B>Up:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html" 
name=tex2html301>Non-Programmers Tutorial For Python</A> <B>Previous:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node11.html" 
name=tex2html295>For Loops</A> &nbsp; <B><A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node2.html" 
name=tex2html303>Contents</A></B> <BR><BR><!--End of Navigation Panel--><!--Table of Child-Links--><A 
name=CHILD_LINKS><STRONG>Subsections</STRONG></A> 
<UL>
  <LI><A 
  href="http://www.honors.montana.edu/~jjc/easytut/easytut/node12.html#SECTION001210000000000000000" 
  name=tex2html306>Examples</A> 
  <LI><A 
  href="http://www.honors.montana.edu/~jjc/easytut/easytut/node12.html#SECTION001220000000000000000" 
  name=tex2html307>Exercises</A> </LI></UL><!--End of Table of Child-Links-->
<HR>

<H1><A name=SECTION001200000000000000000>Boolean Expressions</A> </H1>Here is a 
little example of boolean expressions (you don't have to type it in): <PRE>a = 6
b = 7
c = 42
print 1, a == 6
print 2, a == 7
print 3,a == 6 and b == 7
print 4,a == 7 and b == 7
print 5,not a == 7 and b == 7
print 6,a == 7 or b == 7
print 7,a == 7 or b == 6
print 8,not (a == 7 and b == 6)
print 9,not a == 7 and b == 6
</PRE>With the output being: <PRE>1 1
2 0
3 1
4 0
5 1
6 1
7 0
8 1
9 0
</PRE>What is going on? The program consists of a bunch of funny looking 
<TT>print</TT> statements. Each <TT>print</TT> statement prints a number and a 
expression. The number is to help keep track of which statement I am dealing 
with. Notice how each expression ends up being either 0 or 1. In Python false is 
written as 0 and true is written as 1. The lines: <PRE>print 1, a == 6
print 2, a == 7
</PRE>print out a 1 and a 0 respectively just as expected since the first is 
true and the second is false. The third print, <CODE>print 3,a == 6 and b == 
7</CODE>, is a little different. The operator <TT>and</TT> means if both the 
statement before and the statement after are true then the whole expression is 
true otherwise the whole expression is false. The next line, <CODE>print 4,a == 
7 and b == 7</CODE>, shows how if part of an <TT>and</TT> expression is false, 
the whole thing is false. The behavior of <TT>and</TT> can be summarized as 
follows: 
<P>
<TABLE border=1 cellPadding=3>
  <TBODY>
  <TR>
    <TD align=left>expression</TD>
    <TD align=left>result</TD></TR>
  <TR>
    <TD align=left>true and true</TD>
    <TD align=left>true</TD></TR>
  <TR>
    <TD align=left>true and false</TD>
    <TD align=left>false</TD></TR>
  <TR>
    <TD align=left>false and true</TD>
    <TD align=left>false</TD></TR>
  <TR>
    <TD align=left>false and false</TD>
    <TD align=left>false</TD></TR></TBODY></TABLE>
<P>Notice that if the first expression is false Python does not check the second 
expression since it knows the whole expression is false. 
<P>The next line, <CODE>print 5,not a == 7 and b == 7</CODE>, uses the 
<TT>not</TT> operator. <TT>not</TT> just gives the opposite of the expression 
(The expression could be rewritten as <TT>print 5,a != 7 and b == 7</TT>). Heres 
the table: 
<P>
<TABLE border=1 cellPadding=3>
  <TBODY>
  <TR>
    <TD align=left>expression</TD>
    <TD align=left>result</TD></TR>
  <TR>
    <TD align=left>not true</TD>
    <TD align=left>false</TD></TR>
  <TR>
    <TD align=left>not false</TD>
    <TD align=left>true</TD></TR></TBODY></TABLE>
<P>The two following lines, <CODE>print 6,a == 7 or b == 7</CODE> and 
<CODE>print 7,a == 7 or b == 6</CODE>, use the <TT>or</TT> operator. The 
<TT>or</TT> operator returns true if the first expression is true, or if the 
second expression is true or both are true. If neither are true it returns 
false. Here's the table: 
<P>
<TABLE border=1 cellPadding=3>
  <TBODY>
  <TR>
    <TD align=left>expression</TD>
    <TD align=left>result</TD></TR>
  <TR>
    <TD align=left>true or true</TD>
    <TD align=left>true</TD></TR>
  <TR>
    <TD align=left>true or false</TD>
    <TD align=left>true</TD></TR>
  <TR>
    <TD align=left>false or true</TD>
    <TD align=left>true</TD></TR>
  <TR>
    <TD align=left>false or false</TD>
    <TD align=left>false</TD></TR></TBODY></TABLE>
<P>Notice that if the first expression is true Python doesn't check the second 
expression since it knows the whole expression is true. This works since 
<TT>or</TT> is true if at least one half of the expression is true. The first 
part is true so the second part could be either false or true, but the whole 
expression is still true. 
<P>The next two lines, <CODE>print 8,not (a == 7 and b == 6)</CODE> and 
<CODE>print 9,not a == 7 and b == 6</CODE>, show that parentheses can be used to 
group expressions and force one part to be evaluated first. Notice that the 
parentheses changed the expression from false to true. This occurred since the 
parentheses forced the <TT>not</TT> to apply to the whole expression instead of 
just the <TT>a == 7</TT> portion. 
<P>Here is an example of using a boolean expression: <PRE>list = ["Life","The Universe","Everything","Jack","Jill","Life","Jill"]

#make a copy of the list
copy = list[:]
#sort the copy
copy.sort()
prev = copy[0]
del copy[0]

count = 0

#go through the list searching for a match
while count &lt; len(copy) and copy[count] != prev:
    prev = copy[count]
    count = count + 1

#If a match was not found then count can't be &lt; len
#since the while loop continues while count is &lt; len
#and no match is found
if count &lt; len(copy):
    print "First Match: ",prev
</PRE>
<P>And here is the output: <PRE>First Match:  Jill
</PRE>
<P>This program works by continuing to check for match <TT>while count &lt; 
len(copy and copy[count]</TT>. When either <TT>count</TT> is greater than the 
last index of <TT>copy</TT> or a match has been found the <TT>and</TT> is no 
longer true so the loop exits. The <TT>if</TT> simply checks to make sure that 
the <TT>while</TT> exited because a match was found. 
<P>The other `trick' of <TT>and</TT> is used in this example. If you look at the 
table for <TT>and</TT> notice that the third entry is ``false and won't check''. 
If <TT>count &gt;= len(copy)</TT> (in other words <TT>count &lt; len(copy)</TT> 
is false) then copy[count] is never looked at. This is because Python knows that 
if the first is false then they both can't be true. This is known as a short 
circuit and is useful if the second half of the <TT>and</TT> will cause an error 
if something is wrong. I used the first expression (<TT>count &lt; 
len(copy)</TT>) to check and see if <TT>count</TT> was a valid index for 
<TT>copy</TT>. (If you don't believe me remove the matches `Jill' and `Life', 
check that it still works and then reverse the order of <TT>count &lt; len(copy) 
and copy[count] != prev</TT> to <TT>copy[count] != prev and count &lt; 
len(copy)</TT>.) 
<P>Boolean expressions can be used when you need to check two or more different 
things at once. 
<P>
<H1><A name=SECTION001210000000000000000>Examples</A> </H1>
<P>password1.py <PRE>## This programs asks a user for a name and a password.
# It then checks them to make sure the the user is allowed in.

name = raw_input("What is your name? ")
password = raw_input("What is the password? ")
if name == "Josh" and password == "Friday":
    print "Welcome Josh"
elif name == "Fred" and password == "Rock":
    print "Welcome Fred"
else:
    print "I don't know you."
</PRE>
<P>Sample runs <PRE>What is your name? Josh
What is the password? Friday
Welcome Josh

What is your name? Bill
What is the password? Money
I don't know you.
</PRE>
<P>
<H1><A name=SECTION001220000000000000000>Exercises</A> </H1>
<P>Write a program that has a user guess your name, but they only get 3 chances 
to do so until the program quits. 
<P>
<HR>
<!--Navigation Panel--><A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node13.html" 
name=tex2html304><IMG align=bottom alt=next border=0 height=24 
src="node12_files/next.png" width=37></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html" 
name=tex2html300><IMG align=bottom alt=up border=0 height=24 
src="node12_files/up.png" width=26></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node11.html" 
name=tex2html294><IMG align=bottom alt=previous border=0 height=24 
src="node12_files/prev.png" width=63></A> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node2.html" 
name=tex2html302><IMG align=bottom alt=contents border=0 height=24 
src="node12_files/contents.png" width=65></A> <BR><B>Next:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node13.html" 
name=tex2html305>Dictionaries</A> <B>Up:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/easytut.html" 
name=tex2html301>Non-Programmers Tutorial For Python</A> <B>Previous:</B> <A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node11.html" 
name=tex2html295>For Loops</A> &nbsp; <B><A 
href="http://www.honors.montana.edu/~jjc/easytut/easytut/node2.html" 
name=tex2html303>Contents</A></B> <!--End of Navigation Panel-->
<ADDRESS>Josh Cogliati <A 
href="mailto:jjc@honors.montana.edu">jjc@honors.montana.edu</A> 
</ADDRESS></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区在线观看视频 | 夜夜嗨av一区二区三区中文字幕| 久久国产尿小便嘘嘘| 日韩精品中午字幕| 国产一区二区主播在线| 久久久另类综合| 91丨九色丨黑人外教| 亚洲午夜久久久久久久久电影网 | 99热国产精品| 亚洲激情在线播放| 欧美日韩国产免费| 精品一区二区国语对白| 欧美国产日韩一二三区| 91麻豆免费看片| 日韩激情视频在线观看| 26uuu色噜噜精品一区二区| 成人av在线看| 亚洲6080在线| 日本一区二区三区四区| 色偷偷一区二区三区| 日韩精品一二三| 国产欧美日韩亚州综合 | 丝袜美腿亚洲综合| 亚洲精品在线观| 91美女精品福利| 精品在线观看免费| 亚洲欧美另类久久久精品2019| 欧美精品久久久久久久久老牛影院 | 欧美aaa在线| 国产精品私房写真福利视频| 欧美日韩午夜在线| 国产成人在线免费| 亚洲乱码日产精品bd| 欧美草草影院在线视频| yourporn久久国产精品| 六月丁香婷婷色狠狠久久| 中文在线一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 在线欧美日韩国产| 韩国v欧美v亚洲v日本v| 亚洲在线视频网站| 精品久久五月天| 欧美精品乱码久久久久久按摩| 不卡一区二区在线| 蜜臀精品久久久久久蜜臀| 亚洲免费在线电影| 国产欧美精品国产国产专区 | 久久久亚洲高清| 欧美日韩一区精品| 91无套直看片红桃| 国产成人在线视频网站| 精品一区二区综合| 日韩电影在线一区二区三区| 亚洲日本在线天堂| 欧美国产视频在线| 久久综合色天天久久综合图片| 欧美怡红院视频| 91免费看片在线观看| 国产精品一区二区黑丝| 日本亚洲三级在线| 亚洲电影一区二区三区| 亚洲免费在线视频| 亚洲精品亚洲人成人网在线播放| www国产成人免费观看视频 深夜成人网| 欧美系列在线观看| 91久久精品网| 色婷婷国产精品久久包臀| 成人91在线观看| 成人的网站免费观看| 成人激情免费电影网址| 成人一区在线观看| 高清久久久久久| 丁香啪啪综合成人亚洲小说| 国产一区二区影院| 成人在线一区二区三区| 成人夜色视频网站在线观看| 国产乱码精品一区二区三区av | 久久久久久影视| 日韩美一区二区三区| 日韩丝袜情趣美女图片| 欧美一区二区日韩| 欧美精品一区视频| 国产亚洲欧美一区在线观看| 国产欧美日韩三级| 亚洲日本va在线观看| 亚洲视频在线观看一区| 一区二区三区不卡在线观看 | 久久久久久免费毛片精品| 欧美不卡一二三| 国产日韩欧美不卡在线| 日本一区二区三区国色天香| 国产精品视频一区二区三区不卡| 国产精品精品国产色婷婷| 日韩毛片精品高清免费| 伊人色综合久久天天人手人婷| 亚洲一区自拍偷拍| 蜜臀av性久久久久蜜臀aⅴ四虎| 免费成人在线观看| 岛国精品一区二区| 欧美狂野另类xxxxoooo| 欧美日韩一区中文字幕| 欧美精品一区二区久久婷婷 | 国产亚洲人成网站| 国产精品乱码妇女bbbb| 亚洲综合色婷婷| 久久精工是国产品牌吗| 丁香婷婷综合激情五月色| 欧洲精品在线观看| 日韩午夜小视频| 1024精品合集| 图片区小说区区亚洲影院| 日韩中文字幕av电影| 丁香六月久久综合狠狠色| 欧美午夜精品免费| 久久久精品免费网站| 亚洲乱码国产乱码精品精小说| 天天做天天摸天天爽国产一区| 精一区二区三区| 欧洲色大大久久| 欧美精品一区二区在线观看| 亚洲免费视频中文字幕| 精彩视频一区二区三区| 在线视频国内一区二区| 精品久久久久99| 亚洲一区二区三区四区的| 激情综合一区二区三区| 日本二三区不卡| 国产日韩欧美电影| 蜜桃精品在线观看| 色猫猫国产区一区二在线视频| 日韩欧美激情一区| 亚洲日本电影在线| 极品美女销魂一区二区三区免费| 欧美综合亚洲图片综合区| 亚洲品质自拍视频网站| 国内精品国产成人国产三级粉色| 一本色道久久综合亚洲91| 26uuuu精品一区二区| 亚洲成人福利片| 色婷婷综合激情| 亚洲国产精品av| 国内精品伊人久久久久av影院| 欧美日韩一区国产| 一区二区三区日韩精品视频| 国产综合色视频| 67194成人在线观看| 国产精品国产三级国产三级人妇 | 欧美日韩久久一区| 亚洲天堂av一区| 99视频一区二区三区| 久久久青草青青国产亚洲免观| 首页综合国产亚洲丝袜| 色av成人天堂桃色av| 亚洲欧洲三级电影| 懂色av中文字幕一区二区三区| 精品国产乱码久久久久久1区2区| 视频在线在亚洲| 欧美天堂一区二区三区| 尤物在线观看一区| 色菇凉天天综合网| 亚洲欧美日韩国产综合在线| 成人av第一页| 亚洲人吸女人奶水| 91丨九色丨蝌蚪丨老版| 国产精品福利影院| 成人妖精视频yjsp地址| 国产精品网站导航| jvid福利写真一区二区三区| 中文天堂在线一区| 91亚洲精品一区二区乱码| 国产精品理论在线观看| 99久久99久久免费精品蜜臀| 国产精品免费av| 色婷婷精品大在线视频| 亚洲精品国产视频| 欧洲一区二区三区免费视频| 亚洲一区二区三区三| 欧美性一二三区| 日本人妖一区二区| 精品精品国产高清一毛片一天堂| 精品伊人久久久久7777人| 久久久久久久电影| 99这里都是精品| 亚洲成人动漫在线观看| 欧美一区二区三区四区五区| 久久精品免费看| 中文幕一区二区三区久久蜜桃| 91香蕉视频mp4| 日本怡春院一区二区| 久久亚洲一区二区三区明星换脸 | 亚洲国产精品一区二区尤物区| 欧美欧美欧美欧美| 国产在线视频一区二区三区| 亚洲国产高清aⅴ视频| 91亚洲国产成人精品一区二区三 | 久久久久久久久久久黄色| 国产成人久久精品77777最新版本| 国产精品不卡在线| 久久久久久久久久电影| 99久久国产综合色|国产精品|