Coding Exercise for Beginners in Python with solution | Exercise 25 | Python for Beginners #lec75

preview_player
Показать описание
In this video we will write a python program to find out number of Days in a given Month. We will use the concept of leap year as well.

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #codingquestions #python #pythonforbeginners #jennyslectures
Рекомендации по теме
Комментарии
Автор

Our Andhra students scoring well in python, our faculties worrying about other languages... please teach other languages too....

MVAbhi-fezr
Автор

def l(year):
if year%400==0:
return True
elif year%100==0:
return False
elif year%4==0:
return True
return False
year=int(input(" enter an year "))
month=int(input(" enter a month "))
if l(year):
if month%2==1:
print(" number of days are 31 ")
elif month==2:
print(" number of days are 29 ")
elif month%2==0:
print(" number of days are 30 ")
else:
if month%2==1:
print(" number of days are 31 ")
elif month==2:
print(" number of days are 28 ")
elif month%2==0:
print(" number of days are 30 ")

vandainff
Автор

i have 5 year experience of software development parr ajj bhi tumhariii khoobsoorti daikhnai kai liyai sirf tumhari videos daikhta ha . True fan

syed
Автор

Your videos are a great resource for anyone learning to code. Thank you for creating it!❣

MyCodingDiary
Автор

Ma'am this video so much help me . This coding exercise session is so much help full. You are so awesome Ma'am . And u are so humble and intelligent .

Ma'am u are a beauty with mind .

cyberpunk_.
Автор

def leap_year(year):
if (year%4==0 and year%100!=0) or (year%4==0 and year%100==0 and year%400==0):
return True
else:
return False

year=int(input())
month=int(input())
days=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if leap_year(year) and month==2:
print("29")
else:
print(days[month-1])
This my understanding medam😃😃

bhavanisankar
Автор

thanks mam for ur appriciable efforts for us FROM REWARI (HARYANA)❤❤❤

ramanyadav
Автор

i=0
while i<3:
i+=1
print(i, end=', ')
print('loop complete ')
The output is..
>>>1, 2, 3, loop complete
My Qe is Why out of loop print statement is executed with end=??

saurav_biswas
Автор

Wow madam 😍😍😍, soo easy. I understand everything 😊. Please make tough lecture 🙏, tough questions

nickranjan
Автор

import calendar
year=int(input("enter the year: "))
month=int(input("enter the month: "))
def days(year, month):
for month in range(1, 13):
if year%4==0:
if year%100==0:
if year%400==0:
return "leap"
else:
return "no leap"
else:
return "leap"
else:
return "no leap"
days_in_month = calendar.monthrange(year, month)[1]
result = days_in_month
print(days_in_month)

AnirudhKumar-lr
Автор

a=int(input('enter the year: '))
b=int(input('enter the month number: '))
def leap_year(num):
if num%4==0:
if num%100==0:
if num%400==0:
return 'leap year'
else:
return 'leap year'
else:
return 'normal year'
year=leap_year(a)
def result(Y, M):
if Y=='leap year' and M==2:
print('This month contains 29 days.')
elif Y=='normal year' and M==2:
print('This month contains 28 days')
elif M==1 or M==3 or M==5 or M==7 or M==8 or M==10 or M==12:
print('This month contains 31 days')
elif M==4 or M==6 or M==9 or M==11:
print('This month contains 30 days')
result(year, b)

jahnavikalluru
Автор

Mam ur done one crime mam uknown please answer me mam🥰🥰🥰

ALL_ROUNDER
Автор

year= int(input("Please enter the year: "))
month= int(input('Please enter the month: '))
if month ==2:
if (year %4)==0:
if (year % 100)==0:
if (year% 400)==0:
print("29 Days!!")
else:
print("28 days!!")
else:
print("29 Days!!")
else:
print("28 days!!")
elif month == 1 or month ==3 or month ==5 or month ==7 or month ==8 or month ==10 or month ==12:
print("31 days!!")
elif month== 4 or month== 6 or month== 9 or month == 11:
print("30 days!!")
else:
print('Invalid entry!')
print('Thank you!!')

sidharthkaruvarath
Автор

Madam can you help us slove hackerrank python solutions

sanjay_sanju
Автор

def leapyear(year):
if year % 4 == 0 and year % 100 != 0:
return True
elif year % 4 == 0 and year % 100 == 0:
if year % 400 == 0:
return True
else:
return False
else:
return False

def manydays(year, month):
if month == 2:
if leapyear(year) == True:
return 29
else:
return 28
dict1 = {1:31, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31}
if month in dict1:
return dict1[month]


while True:
year = int(input("Enter year: "))
if len(str(year)) == 4:
break
else:
print("Enter valid year")
while True:
month = int(input("Enter digits for month: "))
if month < 0 or month > 12:
print("Enter valid month")
else:
break
result = manydays(year, month)
print(f"Number of days in {month}/{year} is {result}")

chinenyeumeaku
Автор

Madam please upload Java programming course video's

Sivalakshmi_Music
Автор

def month_days():

index = (input("Enter month: ")).lower()

if index == 'sep' or index == 'apr' or index == 'jun' or index == 'nov':
return (f"{index.title()} has 30 Days.")
elif index == 'feb':
year = int(input("Enter year to check for leap or not: "))
if year % 4== 0 and year % 100 != 0 or year % 400 == 0:
return (f"{index.title()} has 29 Days.")
else: return (f"{index.title()} has 28 Days.")

return
else:
return (f"{index} has 31 Days.")
print(month_days())

tayyabusman
Автор

def month_checker(years, day):
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if years % 4 == 0 and years % 100 != 0:
days[1] = 29
else:
if years % 400 == 0:
days[1] = 29
else:
days[1] = 28
if day == 0:
return "Please Enter a Valid Month"
return f"The selected month including '{days [day-1]}' days"


year = int(input("Enter a year :"))
month = int(input("Enter a month 1-12 you want to know about the days :"))
print(month_checker(year, month))

robinx
Автор

dict_month = {
1 : 'januvary',
2 : 'febuvary',
3 : 'march',
4 : 'april',
5 : 'may',
6 : 'june',
7 : 'july',
8 : 'august',
9 : 'spetember',
10 : 'october',
11 : 'november',
12 : 'december'
}

def leap(year): # 1= leap year 2= not leap year
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
return (1, f'{year}')
else:
return (2, f'{year}')
else:
return (1, f'{year}')
else:
return (2, f'{year}')


def user():
year = int(input('enter a year: '))
leap_checker = leap(year)
month = int(input('enter month(1-12): '))
day_list = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

if leap_checker[0] == 1: #leap year
if month == 1 or month in range(3, 13):
return (f'{leap_checker[1]} is leap year and {dict_month[month]} has {day_list[month-1]} days')
if month == 2:
return (f'{leap_checker[1]} is leap year and {dict_month[month]} has 29 days')

if leap_checker[0] == 2: #non leap year
if month == 1 or month in range(3, 13):
return (f"{leap_checker[1]} isn't leap year and {dict_month[month]} has {day_list[month-1]} days")
if month == 2:
return (f"{leap_checker[1]} isn't leap year and {dict_month[month]} has 28 days")

print(user())

رينشاد_أ
Автор

Jenny Bhabhi, Data science series shuru kariye

AshishVerma-hlil