Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2: Variables and Data Types

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

Function ข้อไหนที่แปลงค่าให้เป็น String
Which function converts a value to a String?

a)

int()

b)

float()

c)

str()

d)

book()

2.

ข้อใดเป็น Dictionary

a)

{1, 2, 3)

b)

[1, 2, 3]

c)

{"one": 1, "two": 2, "three": 3}

d)

(1, 2, 3)

3.

ข้อใดเป็นการประกาศตัวแปร Variable ที่ถูกต้อง
Which is the correct declaration of a variable?

a)

int x = 5

b)

x = 5

c)

variable x = 5

d)

x == 5

4.

ข้อใดเป็นชื่อตัวแปร variable ที่ไม่ถูกหลักการประกาศตัวแปรภาษาไพทอน
Which of the following is a variable name that does not comply with the Python variable declaration principles?

a)

coding111file

b)

1name

c)

y

d)

var_1

5.

ข้อใดเป็นการใช้คำสั่ง print ที่ถูกต้อง
Which is the correct use of the print command?

a)

print "Hello World"

b)

print: 'Hello World'

c)

print('Hello World')

d)

print(Hello World)

6.

คำสั่งแสดงผลทางหน้าจอ คือคำสั่งอะไร
What is the display command?

(a)  

7.

ตัวแปรชนิด _________ ใช้เก็บค่าตัวเลข เช่น 10, 3.14

Variables of type _________ are used to store numeric values, such as 10, 3.14.

(a)  

8.

การกำหนดค่าหลายตัวแปรในบรรทัดเดียวกันทำได้ เช่น 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)  

9.

ค่าชนิด _________ ใช้เก็บข้อความ เช่น "Hello" หรือ 'Python'
The _________ type is used to store text, such as "Hello" or 'Python'.

(a)  

10.

  • ค่าชนิด ______ ใช้เก็บค่าตัวเลขเป็นทศนิยม เช่น 2.0 3.18

  • The ______ type is used to store numeric values ​​as decimals, such as 2.0 or 3.18.



(a)