Python Power-Up: Leap Year

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Python be like: To create an AI bot, import the aiBot module, and there you go!

PRVLEED
Автор

To the people commenting that you can just divide by 4:
Dividing by 4 is actually not sufficient, since the leap year system is a bit more complicated. But it does work MOST of the time...

Wrecker
Автор

It is in fact a single line code:

isLeap = year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

where 'year' is the year to be checked (can be taken as user input)

This single line can also be returned in a function, which is literally what the calendar module does.

saaofficial
Автор

Did you know you can basically do everything with a programming language as long as the user base is big enough? So weird how statistics works (which you can also do with Python)

thomasvnl
Автор

Ok, how many lines are there in calendar module? 😂

gdgd
Автор

Meanwhile my dumb@ thought that it would be something like

Import calendar
If calendar contains February 29 then print ("leap year")

But after seeing the correct way, I see many things that would go wrong with my version lol

ThatBuckskin-Frank
Автор

In future...
From gta import gta6
gta6.create()

yourmama
Автор

Import a whole module for testing the reminder for a divison by 4? 😅

sorin.n
Автор

It's nothing expect making a library amd then accessing it, if c++ developed libraries like this, python's nowhere then, that's for sure

somdebsar
Автор

oh wow next milestone should be adding two numbers I assume you'll import ml lib for it hehhehehehhehe😂

arunprashanth
Автор

Since, year is leap if it is divisible by 4 but 1800, 1900, 2100 are not leap because they are divisible by 100 and not 400

saurabh
Автор

I can check without even importing the calender module...

karthikyerra
Автор

This sure is 1 Line of code
print((year % 100) % 4 == 0)

RobokiYT
Автор

Can you make a full roblox lua coding course for beginners?

lolgoodbye
Автор

cmon to do it by yourself you need 3 lines of code...

jonipara
Автор

Hello i would like to rejoinder with you but i have probleme for language english iam debetante for english

omadam
Автор

did you know, you can check if year is leap in one line of code?

year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) 😂

dzuchun
Автор

And writing it in c as a Beginner will make you mad

bhishek_
Автор

Frt de manhã e domingo para todos nós vamos ter fé em Deus em casa e vou fazer nada de bom para todos os momentos de natal

marciamarquene
Автор

Or just see if it's a whole number after dividing by 4😂😂😂

Jackie