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

歡迎訪問 生活随笔!

生活随笔

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

python

Coursera课程Python for everyone:chapter4

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

Chapter 4

10?試題

1.?

Which Python keyword indicates the start of a function definition?

def

help

sweet

continue

2.?

In Python, how do you indicate the end of the block of code that makes up the function?

You de-indent a line of code to the same indent level as the?def?keyword

You put the "END" keyword in column 7 of the line which is to be the last line of the function

You add the matching curly brace that was used to start the function }

You put a # character at the end of the last line of the function

3.?

In Python what is the?raw_input()?feature best described as?

The central processing unit

A built-in function

A reserved word

A user-defined function

4.?

What does the following code print out?

def thing():print 'Hello'print 'There'

There

Hello

Hello

There

thing

Hello

There

5.?

In the following Python code, which of the following is an "argument" to a function?

x = 'banana' y = max(x) print y

print

x

y

max

6.?

What will the following Python code print out?

def func(x) :print xfunc(10) func(20)

x

10

x

20

10

20

x

20

func

func

7.?

Which line of the following Python program is useless?

def stuff():print 'Hello'returnprint 'World'stuff()

def stuff():

return

stuff()

print 'Hello'

print 'World'

8.?

What will the following Python program print out?

def greet(lang):if lang == 'es':return 'Hola'elif lang == 'fr':return 'Bonjour'else:return 'Hello'print greet('fr'),'Michael'

Bonjour Michael

def Michael

Hello Michael

Hola

Bonjour

Hello

9.?

What does the following Python code print out? (Note that this is a bit of a trick question and the code has what many would consider to be a flaw/bug - so read carefully).

def addtwo(a, b):added = a + breturn ax = addtwo(2, 7) print x

7

2

14

addtwo

10.?

What is the most important benefit of writing your own functions?

Following the rule that whenever a program is more than 10 lines you must use a function

To avoid having more than 10 lines of sequential code without an indent or de-indent

Avoiding writing the same non-trivial code more than once in your program

Following the rule that no function can have more than 10 statements in it

總結

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

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