#Kiem tra (a, b, c) co phai 3 canh cua 1 tam giac hay khong
def main():
a= float(raw_input('Nhap vao canh a= '))
b= float(raw_input('Nhap vao canh b= '))
c= float(raw_input('Nhap vao canh c= '))
if a+b>c and b+c>a and c+a>b:
print "(%d, %d, %d) la 3 canh 1 tam giac :D" %(a, b, c)
else:
print "K phai 3 canh 1 tam giac."
if __name__ == '__main__':
main()
----------------------------------------------
#Lap trinh doi chu thuong thanh chu hoa
def main():
s= raw_input('Nhap vao 1 xau ky tu: ')
print s.upper()
if __name__== '__main__':
main()
----------------------------------------------
#Doi cho 2 bien gia tri kieu real
def main():
a= float(raw_input('a= '))
b= float(raw_input('b= '))
a, b= b, a
print a, b
if __name__== '__main__':
main()
No comments:
Post a Comment