Bộ 4: Python cơ bản: variable, for loop, if-elif-else

Bộ 4: Python cơ bản: variable, for loop, if-elif-else

Assessment

Flashcard

Information Technology (IT)

University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

14 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Trong Python, lệnh nào dùng để gán giá trị 10 cho biến x?

Back

x = 10

Answer explanation

Để gán giá trị cho biến x, dùng dấu = trong Python

2.

FLASHCARD QUESTION

Front

Trong Python, lệnh nào sau đây dùng để kiểm tra nếu x lớn hơn 5?

Back

if x > 5:

Answer explanation

Dấu > được dùng để so sánh lớn hơn trong Python

3.

FLASHCARD QUESTION

Front

Trong Python, range(5) tạo ra dãy số nào?

Back

0, 1, 2, 3, 4

Answer explanation

range(5) trả về các giá trị từ 0 đến 4

4.

FLASHCARD QUESTION

Front

Trong Python, câu lệnh nào đúng để in từng ký tự trong chuỗi s?

Back

for c in s:

Answer explanation

for c in s duyệt qua từng ký tự trong chuỗi s

5.

FLASHCARD QUESTION

Front

Phép so sánh nào dùng để kiểm tra x khác 0 trong Python?

Back

x != 0

Answer explanation

Trong Python, != được dùng để so sánh khác

6.

FLASHCARD QUESTION

Front

Kết quả của biểu thức 3 * 2 ** 2 là gì?

Back

3 * (2 ** 2) = 12

Answer explanation

2 ** 2 = 4, khi nhân với 3, kết quả là 12

7.

FLASHCARD QUESTION

Front

Điều kiện nào đúng để kiểm tra n nằm trong khoảng [1, 10]? Options: if 1 <= n and n <= 10:, if 1 <= n <= 10:, if n in range(1,10):, if n in [1..10]:

Back

if 1 <= n <= 10:

Answer explanation

Trong Python có thể viết gộp: if 1 <= n <= 10

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?