โจทย์แบบฝึกหัดนี้เอามาจาก markpruet เพื่อใช้ฝึกฝนเขียนโปรแกรม
1.
รับค่า a และ b เป็นเลขจำนวนเต็ม จากนั้นทำการสลับค่าตัวแปร
a = int(input("a = "))
b = int(input("b = "))
a ,b = b, a
print(f"a = {a}")
print(f"b = {b}")
2.
รับเลขจำนวนเต็ม n แล้วแสดงว่าเลขนั้นเป็นเลขคู่หรือไม่
n = int(input("Enter a number: "))
t_or_f = n % 2 == 0
print(t_or_f)
3.
รับเลขจำนวนเต็มสองตัว a กับ b แล้วแสดงว่า a มากกว่า b หรือไม่
a = int(input("Enter a number: "))
b = int(input("Enter a number: "))
over = a > b
print(over)
-
Notifications
You must be signed in to change notification settings - Fork 0
iamspur/06_Booleans
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
Repository files navigation
About
รวมโจทย์พื้นฐาน Booleans
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published