日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

Coursera课程Python for everyone:chapter6

發布時間:2025/3/21 python 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Coursera课程Python for everyone:chapter6 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Chapter 6 Quiz

10?試題

1.?

What does the following Python Program print out?

str1 = "Hello" str2 = 'there' bob = str1 + str2 print bob

Hellothere

Hello there

Hello

there

Hello

2.?

What does the following Python program print out?

x = '40' y = int(x) + 2 print y

402

42

int402

x2

3.?

How would you use the index operator [] to print out the letter q from the following string?

x = 'From marquard@uct.ac.za'

print x[q]

print x[8]

print x[9]

print x[-1]

print x[7]

4.?

How would you use string slicing [:] to print out 'uct' from the following string?

x = 'From marquard@uct.ac.za'

print x[14:17]

print x[14:3]

print x[15:18]

print x[14+17]

print x[15:3]

print x[14/17]

5.?

What is the iteration variable in the following Python code?

for letter in 'banana' :print letter

print

letter

for

'banana'

in

6.?

What does the following Python code print out?

print len('banana')*7

bananabananabananabananabananabananabanana

42

banana7

0

7.?

How would you print out the following variable in all upper case in Python?

greet = 'Hello Bob'

console.log(greet.toUpperCase());

print uc($greet);

print greet.upper()

puts greet.ucase; 8.?

Which of the following is?not?a valid string method in Python?

boldface()

upper()

lower()

lstrip()

startswith()

9.?

What will the following Python code print out?

data = 'From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008' pos = data.find('.') print data[pos:pos+3]

mar

uct

Sat

.ma

10.?

Which of the following string methods removes whitespace from both the beginning and end of a string?

strip()

split()

wsrem()

strtrunc()

總結

以上是生活随笔為你收集整理的Coursera课程Python for everyone:chapter6的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。