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相关推荐

  1. Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python

    Many-to-Many Relationships and Python 9 试题

  2. Coursera课程Python for everyone:Quiz: Multi-Table Relational SQL

    Multi-Table Relational SQL 10 试题 1. What is the primary added value of relational databases over fla ...

  3. Coursera课程Python for everyone:Quiz: Single-Table SQL

    Single-Table SQL 11 试题 1. Structured Query Language (SQL) is used to (check all that apply) Delete d ...

  4. Coursera课程Python for everyone:Quiz: Object Oriented Programming

    Object Oriented Programming 11 试题 1. Which came first, the instance or the class? instance class fun ...

  5. Coursera课程Python for everyone:Quiz: REST, JSON, and APIs

    REST, JSON, and APIs 10 试题 1. Who is credited with getting the JSON movement started? Pooja Sankar M ...

  6. Coursera课程Python for everyone:Quiz: eXtensible Markup Language

    eXtensible Markup Language 10 试题 1. What is "serialization" when we are talking about web ...

  7. Coursera课程Python for everyone:Quiz: Reading Web Data From Python

    Reading Web Data From Python 8 试题 1. Which of the following Python data structures is most similar t ...

  8. Coursera课程Python for everyone:Quiz: Networks and Sockets

    Networks and Sockets 10 试题 1. What do we call it when a browser uses the HTTP protocol to load a fil ...

  9. Coursera课程Python for everyone:Quiz: Regular Expressions

    Quiz: Regular Expressions 10 试题 1. Which of the following best describes "Regular Expressions&q ...

最新文章

  1. 触发器——创建||更新||删除||查看
  2. 【Leetcode】背包问题模板
  3. windows 2008 R2下(AD RMS)无法检索证书层次结构的解决方法
  4. 实现 JavaScript 异步方法 Promise.all
  5. 分布式消息中间件-Rocketmq
  6. HttpURLConnection与 HttpClient 区别/性能测试对比
  7. python人脸_Python 使用 face_recognition 人脸识别
  8. access month函数用法_学会了这7个EXCEL日期函数技巧,老板再让你加班,你找我!...
  9. python内置模块重要程度排名_python常用内置模块
  10. 刘海、水滴、挖孔都靠边!中兴吐槽:不配全面屏
  11. 这7本O’Reilly推出的免费Python电子书,够你看了
  12. 摩托罗拉里程碑升级Android 2.2刷机知识
  13. php日志接入rsyslog,php – Rsyslog重复日志(rsyslog.conf和rsyslog.d / something.conf)
  14. 济南 天然气 暖气 物业费 水费 电费价格
  15. Fiddler中文版设置抓取某个网站的信息 2021-07-31
  16. win7未能成功安装驱动服务器,win7插入鼠标提示未能成功安装设备驱动程序的解决办法...
  17. 简单解决某盘限速?(黑科技)【油猴】+【某盘直链下载器】+【IDM下载】
  18. (仅对于普通12分频的51单片机而言)机器周期,时钟周期,晶振振荡频率(fosc)的关系;(51、32通用)分频的原理和作用
  19. 在北京租房 舒舍的租客素质怎么样?
  20. #3189. 八纵八横(c)

热门文章

  1. 无法安装计算机的启动配置,“windows 无法更新计算机的启动配置。安装无法继续”这样解决...
  2. linux 删除20日前数据,Linux 维护常用命令
  3. 实现正则表达式的*和?匹配
  4. Visual Studio 2013开发 mini-filter driver step by step 内核代码段分页alloc_text的使用(9)
  5. Visual Studio 2013开发 mini-filter driver step by step (3) - 查看运行结果
  6. RocketMQ-初体验RocketMQ(07)-使用API操作RocketMQ_顺序消息 ordermessage
  7. 并发编程-03线程安全性之原子性(Atomic包)及原理分析
  8. linux命令行引导iso,如何在Linux上使用命令行从可启动ISO创建可启动USB?
  9. MySQL This function has none of DETERMINISTIC, NO SQL...错误1418 的原因分析及解决方法
  10. python 合并区间