排序
Day 14 – Looping
Day 14 - Looping,1.Find the number is prime or not A prime number is only divisible by 1 and the number itself. no = int(input('Enter no. ')) div = 2 while div<no: if no%div == ...
Day 13 – Looping and Puzzle program
Day 13 - Looping and Puzzle program,1.Collatz sequence Write a program that prints the Collatz sequence for a given number until it reaches 1. Rule: If the number is even: n=n/2 If...
Day 12 – Looping Excercises
Day 12 - Looping Excercises,1.Print this number: 1 2 3 4 5 5 4 3 2 1 no = 1 top = 5 direction = 1 while no>0: print(no,end= ' ') if no == top: print(no,end=' ') direction = -1 n...
Day 10 – Looping
Day 10 - Looping,Write a program to calculate age: from datetime import datetime dob = input('Enter your Date of Birth (yyyy-mm-dd): ') dob_date = datetime.strptime(dob, '%Y-%m-%d'...
Day 9 – Looping
Day 9 - Looping,pycache: pycache is a directory created by Python to store compiled versions of your Python scripts. These files have a .pyc extension and are generated automatical...