1) In Python, what is the purpose of the input() function when used with a variable? a) To display output b) To perform mathematical calculations c) To read user input d) To define a new variable 2) Which of the following is a correct way to concatenate two strings stored in variables name1 and name2? a) name1 + name2 b) join(name1, name2) c) concat(name1, name2) d) merge(name1, name2) 3) What is the data type of the variable in the following statement: price = 29.99? a) Integer b) Float c) String d) Boolean 4) Which of the following is a correct way to assign a value to a variable in Python? a) x = 5 b) x := 5 c) value 5 to x d) x >> 5 5) What is the purpose of the if statement in Python? a) To declare a variable b) To perform conditional execution of code c) To create a loop d) To print output 6) In an if-else statement, what happens if the condition in the if block is not met? a) The else block is executed b) An error occurs c) The program terminates d) The if block is re-evaluated 7) How can multiple conditions be combined in an if statement? a) Using the or keyword b) Using both or and and c) Using the and keyword d) Only one condition is allowed 8) What is the purpose of the elif statement in Python? a) To declare a new variable b) To print output c) To handle multiple conditions d) To end the program 9) What is the role of indentation in Python's if-else statements? a) It is optional and does not affect the code b) It is required to define the scope of the code blocks c) It is used for decoration d) It causes errors
0%
Variable and If Statements
共用
共用
共用
由
Asheik
Secondary
編輯內容
列印
嵌入
更多
作業
排行榜
顯示更多
顯示更少
此排行榜當前是私有的。單擊
共用
使其公開。
資源擁有者已禁用此排行榜。
此排行榜被禁用,因為您的選項與資源擁有者不同。
還原選項
測驗
是一個開放式範本。它不會為排行榜生成分數。
需要登錄
視覺風格
字體
需要訂閱
選項
切換範本
顯示所有
播放活動時將顯示更多格式。
打開結果
複製連結
QR 代碼
刪除
恢復自動保存:
?