0% found this document useful (0 votes)
7 views2 pages

Baitapcoban Py

The document contains a series of Python programming exercises that involve basic arithmetic operations, user input, and calculations related to geometry, temperature conversion, and number manipulation. Each exercise is clearly numbered and demonstrates different programming concepts such as loops and functions. The exercises include calculating the perimeter and area of a rectangle, converting Celsius to Fahrenheit, and performing operations on integers.

Uploaded by

phuxuan03012009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Baitapcoban Py

The document contains a series of Python programming exercises that involve basic arithmetic operations, user input, and calculations related to geometry, temperature conversion, and number manipulation. Each exercise is clearly numbered and demonstrates different programming concepts such as loops and functions. The exercises include calculating the perimeter and area of a rectangle, converting Celsius to Fahrenheit, and performing operations on integers.

Uploaded by

phuxuan03012009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Bai 1

length = float(input("Chieu dai hinh chu nhat "))


width = float(input("Chieu rong hinh chu nhat "))

print("chu vi hinh chu nhat: ", (length + width)*2)


print("dien tich hinh chu nhat: ", length * width)

Bai 2:
C = float(input("Do C: "))

F = (C * 9/5) + 32
print("Do F: ",F)

Bai 3:
a = int(input("Nhap so thu nhat: "))
b = int(input("Nhap so thu hai: "))
c = int(input("Nhap so thu ba: "))

print("Tong cua ba so: ", a+b+c)


print("Tich cua ba so: ", a*b*c)
print("Trung binh cong cua ba so: ", (a+b+c)/3)
print("Trung binh nhan cua ba so: ", pow((a*b*c),1/3))

Bai 4:
a = int(input("Nhap so nguyen co 5 chu so: "))
sum = 0
product = 1

while(a != 0):
sum = sum + (a%10)
product = product * (a%10)
a = int(a/10)

print("Tong chu so: ", sum)


print("Tich chu so: ", product)

Bai 5:
result = 3965940 / (2002 - 22)
print("Toan dinh nhan so ", result, " cho 2002")

Bai 6:
result = 127 * 3 + 148 * 3 - 138 * 5
print("So o giua la ", result)

Bai 7:
result = int(120 * 12 / 80)
print("Gao du tru dung duoc trong ",result, " ngay")

Bai 8;
dai = (160 + 40) / 2
rong = (160 - 40) / 2

print("Chieu dai manh vuon: ", dai)


print("Chieu rong manh vuon: ", rong)

Bai 9:
so_luong = int(62500 / (4000 - 3500))
so_tien = 4000 * so_luong
print("So tien du tru la: ", so_tien, " dong")

Bai 10:
cam = int(18 / (1 + 2 + 3))
tao = cam * 2
xoai = cam * 3

print("So qua cam: ", cam)


print("So qua tao: ", tao)
print("So qua xoai: ", xoai)

You might also like