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コード
削除
自動保存:
を復元しますか?