排序
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 == ...
Python Day- 14 Looping-Exercises and tasks
Python Day- 14 Looping-Exercises and tasks,Prime Numbers: Numbers which are divisible by 1 and itself are called as prime numbers.(Eg-->3,5,7) 1) Find prime number or not: no = ...
Weekend Task
Weekend Task,1.Fahrenheit to Celsius Conversion: def fahrenheit_to_celsius(): celsius=(fahrenheit-32)*5/9 return celsius fahrenheit=float(input('Enter the Fahrenheit:')) celsius=fa...
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...
Python Day-13 Looping-puzzles
Python Day-13 Looping-puzzles,Find whether all digits in a number are equal: no = int(input('Enter no. ')) #333 equal = no #4 while no>0: rem = no #3 if rem == equal: equal=rem ...
Python Day-12 Looping-Exercises,Number game and Tasks
Python Day-12 Looping-Exercises,Number game and Tasks,1)Write a program to get this output: 1 2 3 4 5 5 4 3 2 1 no = 1 top = 5 direction = 1 while no>0: print(no,end= ' ') if no...
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...
Python Day – 11 Looping-Examples and Tasks
Python Day - 11 Looping-Examples and Tasks,Task:1 #Print Numbers #Write a program to print numbers from 1 to 10 using a while loop. def print_numbers(num): no=1 while no<=num: p...
Day 11 – Looping exercises
Day 11 - Looping exercises,Here are some while loop questions focused on numbers for practice: Basic Problems 1.Print Numbers Write a program to print numbers from 1 to 10 using a ...
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...
Python Day-9 Predefined modules,While loop,Task
Python Day-9 Predefined modules,While loop,Task,Predefined modules sys module:(sys.argv) In this module sys.argv is used to show output as lists. For example: Input: import sys pri...