Leap year challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Leap year challenge

ive been trying to complete the leaping year coding challenge in beginner python but i cant find any success i would appreciate any help regarding the matter ive tried many times and just ended up frustrated

26th Apr 2021, 8:46 PM
Mwsdo
Mwsdo - avatar
29 Answers
+ 2
Try to search Code Playground for code examples, see and learn how others are doing it, compare with your logic, and observe where a mistake is in your tryout code 👍
26th Apr 2021, 8:53 PM
Ipang
+ 2
Please, show us your code attempt! We will find mistakes!
26th Apr 2021, 8:58 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
then you have one syntax error in your code. did you find her?
26th Apr 2021, 9:56 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Right! now start debugging the code: in the first test, the correct answer is printed twice, in the second test - both correct and incorrect. delete the section of code that is responsible for this or change your program so that at least one test is printed correctly. your logic as a whole fails
26th Apr 2021, 10:36 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
AI is a large area that includes Machine Learning, Data Science, and Deep Learning, so focus on each of them first. Sololern offers two courses: Machine Learning and Data Science. Python is best suited for this purpose. you can take all five python courses, including the Python course for Data Science. https://code.sololearn.com/We1wBnzl6Sos/?ref=app
27th Apr 2021, 1:55 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
or show your solution logic. the task describes the algorithm for the program in great detail. where are you stuck?
26th Apr 2021, 9:02 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
first, you need to capitalize all the small first letters in the answers, otherwise the test will not miss even the correct answer
26th Apr 2021, 9:53 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
with help of some helpful people like you i completed all the challenges till the while loop points challenge
26th Apr 2021, 11:20 PM
Mwsdo
Mwsdo - avatar
+ 1
in this case, continue learning further
27th Apr 2021, 1:28 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
I'm no expert in AI but here are some blogs and websites that may help, you may also want to use your browser's search engine. https://thenextweb.com/podium/2019/09/13/11-ways-novices-can-start-the-process-of-learning-ai-programming/ https://towardsdatascience.com/i-want-to-learn-artificial-intelligence-and-machine-learning-where-can-i-start-7a392a3086ec https://bigdata-madesimple.com/want-get-started-artificial-intelligence-7-easy-steps/ SoloLearn also has a Machine Learning course (related to AI). https://www.sololearn.com/Course/machine-learning/?ref=app There are many Youtube videos, courses, books and more learning resources that may help you.
27th Apr 2021, 1:57 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
A year for example 2004 when divided by 4 gives a quotient 501 leaving a remainder 0(the year 2004 was leap year) , but when you divide 2014 by 4 then it gives a quotient 503 leaving a remainder 2(the year 2014 was not a leap year) . So at last the conclusion is when a year is divided by 4 and gives a remainder 0 is called a leap year(Mathematically). The Python3 code goes like this: year = int(input()) if year % 4 == 0: print("Leap Year") elif year % 4 != 0: print("Not a Leap Year") else: print("entet a valid year")
27th Apr 2021, 6:48 AM
Manthan Santara
Manthan Santara - avatar
28th Apr 2021, 4:34 PM
Mr.Dark
Mr.Dark - avatar
0
year = int(input()) #your code goes here if year % 4 == 0 and year % 100 != 0: print ("Leap year") else: print ("not a leap year") if year % 400 == 0 print ("leap year") else: print ("not a leap year")
26th Apr 2021, 9:12 PM
Mwsdo
Mwsdo - avatar
0
yes i forgot the :
26th Apr 2021, 10:32 PM
Mwsdo
Mwsdo - avatar
0
thanks i got it correct now
26th Apr 2021, 10:57 PM
Mwsdo
Mwsdo - avatar
0
You passed all tests???
26th Apr 2021, 11:13 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
may I congratulate you?
26th Apr 2021, 11:14 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
i did all the lessons till 28 the bmi calculator now im working on the challenges
26th Apr 2021, 11:52 PM
Mwsdo
Mwsdo - avatar
0
what else do you think i should learn beside python? im mainly looking for artificial intelligence and hacking
27th Apr 2021, 1:28 AM
Mwsdo
Mwsdo - avatar