![](https://rs.olm.vn/images/background/bg0.jpg?v=2)
![](https://rs.olm.vn/images/avt/3.png?131733806534)
ĐẬU PHƯƠNG TÂM
Giới thiệu về bản thân
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_mam_non.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_tan_binh.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_chuyen_can.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_cao_thu.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_thong_thai.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_kien_tuong.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
![xếp hạng xếp hạng](https://rs.olm.vn/images/medal_dai_kien_tuong.png)
![ngôi sao 1 Ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 2 ngôi sao 2](https://rs.olm.vn/images/medal_ngoi_sao.png)
![ngôi sao 3 ngôi sao 1](https://rs.olm.vn/images/medal_ngoi_sao.png)
![sao chiến thắng Sao chiến thắng](https://rs.olm.vn/images/medal_win_1.png)
def is_leap_year(year):
"""Kiểm tra năm có phải năm nhuận không"""
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)
def days_from_start_of_year(day, month, year):
"""Tính số ngày từ đầu năm đến ngày nhập vào"""
days_in_months = [31, 29 if is_leap_year(year) else 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
# Tính tổng số ngày
total_days = sum(days_in_months[:month - 1]) + day
return total_days
# Nhập dữ liệu từ người dùng
day = int(input("Nhập ngày: "))
month = int(input("Nhập tháng: "))
year = int(input("Nhập năm: "))
# Tính toán và hiển thị kết quả
result = days_from_start_of_year(day, month, year)
print(f"Số ngày từ đầu năm {year} đến {day}/{month}/{year} là: {result} ngày")
print("GIẢI BÀI TOÁN GÀ VÀ CHÓ")
print("Vừa gà vừa chó");
print("Bó lại cho tròn");
print("Ba mươi sáu (36) con");
print("Một trăm(100) chân chẵn");
print("Hỏi có mấy gà, mấy chó?");
k = 1
while k < 37:
if((k * 2 + (36 - k) * 4) == 100):
print("Số gà là: ", k)
print("Số chó là: ", 36-k)
k = k + 1
k = int(input('k = '))
if (1 < k < 10):
i = 0
while (True):
i += 1
print (f'{k} x {i} = {k * i}')
if (i == 10):
break
Kết quả:
k = 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
n = int(input("Nhập số tự nhiên n (1 < n <= 20): "))
if 1 < n <= 20:
S = 0
for i in range(n + 1):
S += 1 / (2 ** i)
print(f"Tổng S = {S}")
else:
print("Vui lòng nhập số n thỏa mãn điều kiện 1 < n <= 20.")
n = int(input('Nhập số tự nhiên n: '))
T = 1
for i in range(1,n+1):
T *= i
print('Tích các số từ 1 đến',n,'là:',T)
ho_va_ten=input("nhập họ và tên học sinh:")
t=float(input("Điểm thi Toán:"))
v=float(input("Điểm thi Văn"))
a=float(input("Điểm thi Anh"))
print("Điểm trung bình",(t**2+v+a)/4)
tong=float(input())
hieu=float(input())
a=(tong+hieu)/2
b=tong-a
print(a,b)
#Source Code Tính Chu Vi Và Diện Tích Hình Chữ Nhật
#Chiều Dài
length = float(input("Nhập Chiều Dài: "))
#Chiều Rộng
width = float(input("Nhập Chiều Rộng: "))
#Chu Vi
print("\nChu Vi Hình Chữ Nhật: " + str((length + width) * 2))
#Diện Tích
print("Diện Tích Hình Chữ Nhật: " + str(length * width))
r = int(input("Nhap vao ban kinh duong tron: "))
cv = float(2*r*3.14)
s = float(r*r*3.14)
print("Chu vi: ",cv)
print("Dien tich: ",s)
k =float (input ("Nhập số kWh tiêu thụ điện nhà em: "))
if k<= 50:
t = k*1.678
else:
if k <= 100:
t = 50*1.678 + (k - 50)*1.734
else:
t = 50*1.678 + 50*1.734 + (k - 100)*2.014
print ("Số tiền điện phải trả là: ", round (t) , "nghìn đồng")