Loading...
Vietnam Geography App
Loading...
Vietnam Geography App
Làm chủ luồng chương trình với các cấu trúc điều khiển! Bạn sẽ biết cách ra quyết định, lặp lại thao tác và xây dựng logic thông minh cho mọi ứng dụng Python.
Tính điểm trung bình và xếp loại học tập
print("CHƯƠNG TRÌNH TÍNH ĐIỂM TRUNG BÌNH")
print("Nhập -1 để kết thúc")
scores = []
while True:
score = float(input("Nhập điểm (0-10): "))
if score == -1:
break
if 0 <= score <= 10:
scores.append(score)
else:
print("Điểm không hợp lệ!")
if scores:
average = sum(scores) / len(scores)
print(f"\nSố điểm đã nhập: {len(scores)}")
print(f"Điểm trung bình: {average:.2f}")
if average >= 9:
grade = "Xuất sắc"
elif average >= 8:
grade = "Giỏi"
elif average >= 6.5:
grade = "Khá"
elif average >= 5:
grade = "Trung bình"
else:
grade = "Yếu"
print(f"Xếp loại: {grade}")
else:
print("Không có điểm nào được nhập!")
User authentication systems
Data validation logic
Menu-driven applications
Game logic implementation
Automated decision making
Business rule processing