Worksheets2: Variables and Data Types
Total questions: 10
Worksheet time: 10mins
Function ข้อไหนที่แปลงค่าให้เป็น String
Which function converts a value to a String?
int()
float()
str()
book()
ข้อใดเป็น Dictionary
{1, 2, 3)
[1, 2, 3]
{"one": 1, "two": 2, "three": 3}
(1, 2, 3)
ข้อใดเป็นการประกาศตัวแปร Variable ที่ถูกต้อง
Which is the correct declaration of a variable?
int x = 5
x = 5
variable x = 5
x == 5
ข้อใดเป็นชื่อตัวแปร variable ที่ไม่ถูกหลักการประกาศตัวแปรภาษาไพทอน
Which of the following is a variable name that does not comply with the Python variable declaration principles?
coding111file
1name
y
var_1
ข้อใดเป็นการใช้คำสั่ง print ที่ถูกต้อง
Which is the correct use of the print command?
print "Hello World"
print: 'Hello World'
print('Hello World')
print(Hello World)
คำสั่งแสดงผลทางหน้าจอ คือคำสั่งอะไร
What is the display command?
(a)
ตัวแปรชนิด _________ ใช้เก็บค่าตัวเลข เช่น 10, 3.14
Variables of type _________ are used to store numeric values, such as 10, 3.14.
(a)
การกำหนดค่าหลายตัวแปรในบรรทัดเดียวกันทำได้ เช่น a, b = 5, 10 หมายความว่า a เท่ากับ ___ และ b เท่ากับ ___
It is possible to assign multiple variables on the same line, for example a, b = 5, 10
means that a equals ___ and b equals ___.
(a)
ค่าชนิด _________ ใช้เก็บข้อความ เช่น "Hello" หรือ 'Python'
The _________ type is used to store text, such as "Hello" or 'Python'.
(a)
ค่าชนิด ______ ใช้เก็บค่าตัวเลขเป็นทศนิยม เช่น 2.0 3.18
The ______ type is used to store numeric values as decimals, such as 2.0 or 3.18.
(a)
