国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

9.11前9習(xí)題

2019-11-14 17:01:01
字體:
供稿:網(wǎng)友

 

1.PRint 

(1)打印的第一句 。。。。

1 print " Hello World! "

 

注意""和''的使用

1 print "i'm paul"   #2 3 print 'i'm paul'  # 錯   改為 'i /'m paul'

以及""" """和''' '''的使用

1 print  """2 3 Hello World!4 5 Hello World!6 7 Hello World!8 9 """

 

(2)逗號

print "hello world ",'abc'print "i am paul "

 

結(jié)果:

hello world abc

i am paul

 

print "hello world "  'abc'print "i am paul "

結(jié)果:

hello world abc

 

i am paul

 

print "hello world" ' abc',print "i am paul"

結(jié)果:

hello world abci am paul

 

print "hello world" ' abc',"i am paul"

語法錯誤

 

(3)運算符號

print "now i will count the eggs:"print 3+1+2-5+4%2-1/4print 3+2>4-2

結(jié)果:

now i will count the eggs:

1

True

 

(4)變量及打印

name = "paul"age = 20height = 70print "let's talk about %s"%nameprint "he's %d years old"%ageprint "he's %d inches tall"%heightprint "let's talk about %r"%nameprint "he's %r years old"%ageprint "he's %r inches tall"%height

print "if i add %d and %d,i get %d."%(age,height,age+height)

let's talk about paul

he's 20 years old

he's 70 inches tall

let's talk about "paul"

he's 20 years old

he's 70inches tall

if i add 20 and 70,i get 90

 

x = "there are %d types of people."%10print x print "i said :%r "%xy =  "isn't that joke so funny? %r"z = Falseprint y%za = "this is the left of"b = "a string with a right side"print a + b

結(jié)果:
there are 10 types of people.

i said :there are 10 types of people.

isn't that joke so funny?False

this is the left of a string with a right side

 

print "ab " *10

結(jié)果:
ab ab ab ab ab ab ab ab ab ab

formatter = "%r %r %r"print formatter %(1,2,3)print formatter %("one","two","three")print formatter %(True,False,True)print formatter %(   "i had this string",   "that you could ",   "type  up right"       )

1 2 3
'one' 'two' 'three'

True False True

'i had this string' 'that you could' ' type up right'

 

1 a = "a/nb/nc/n"2 print a 

結(jié)果:

a

b

c

 


上一篇:9.129-26節(jié)

下一篇:python與編碼

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 塔城市| 黑河市| 淮阳县| 镇原县| 漳平市| 疏附县| 阿尔山市| 溆浦县| 得荣县| 永兴县| 松江区| 龙海市| 明溪县| 迁安市| 中山市| 东城区| 醴陵市| 靖远县| 天水市| 碌曲县| 呼和浩特市| 阜康市| 宁武县| 滦平县| 桓仁| 定襄县| 和田市| 呈贡县| 岳普湖县| 西贡区| 隆回县| 句容市| 隆化县| 闻喜县| 五华县| 阳新县| 邻水| 兴安县| 惠州市| 长垣县| 红安县|