1. %

num = input('Enter a number')
print('%s%%'%num)  #10%
print("{} %".format(num))  #10%
Copy the code

2. Branch statements if elif else

num = int(input("Digital"))
if (num > 10):
    print("The number is greater than 10")
elif (num > 5):
    print("Numbers greater than 5, less than or equal to 10.")
else:
    print("Number less than or equal to 5"#) and logical operators and (&), an or or (| |), not reverse (!) age = int(input("Age"))
money = int(input("The amount"))
if age>=18 and money >10:  #if not age > 18:
    print("I am rich and handsome.")
else:
    print("The dream silk"Year = int(input()"Input year"))
if (year % 4= =0 and year % 100! =0) or (year % 400= =0):
    print(It's a leap year.)
else:
    print("Not a leap year."# nested sex = input("Input gender")
money = int(input("How much is it?"))
if(sex == "Male") :if(money > 1000):
        print("Rich")
    else:
        print("The poor")
else:
    print("It's a woman.")


importNum = random. Randint ()1.10) # Random integers from1Start to10
print(num)
Copy the code