Help Me With My Python. - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help Me With My Python. (3268 Views)
| Help Me With My Python. by BlowJobs(op): 8:08pm On Jan 26, 2015*. Modified: 7:13am On Oct 26, 2017 |
Hello, guys. i am new to Nairaland. i need help with my python programming i am trying to solve this problem, it's my first exercise and i just picked up python like 4 days ago. month_days= [('January',[31]),('February',[28,29]),('March',[31]), ('April',[30]),('May',[31]),('June',[30]),('July',[31]),('August',[31]), ('September',[30]),('October',[31]),('November',[30]),('December',[31]) ] day_names = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] Problem 1 Write a function days_in_month which takes a month as an argument and finds the corresponding month in the month_days list and returns the number of days associated with that month. >>> days_in_month('December') [31] >>> days_in_month('February') [28, 29] i really don't know how to go about it. i have been reading the ThinkPython for some days now Thanks |
| Re: Help Me With My Python. by BlowJobs(op): 8:23pm On Jan 26, 2015 |
someone there Please |
| Re: Help Me With My Python. by gottfried21(m): 8:42pm On Jan 26, 2015 |
BlowJobs:Hello fellow Namibian! ![]() |
| Re: Help Me With My Python. by BlowJobs(op): 9:22pm On Jan 26, 2015 |
| Re: Help Me With My Python. by gottfried21(m): 10:29pm On Jan 26, 2015 |
BlowJobs:Unfortunately not my brother,Computer programming is something that I am not that familiar with,Anyways hope that one of the nice people on the forum will help you.Shapshap |
| Re: Help Me With My Python. by bb6xt(m): 11:42pm On Jan 26, 2015 |
. |
| Re: Help Me With My Python. by bb6xt(m): 11:42pm On Jan 26, 2015 |
month_days= [('January',[31]),('February',[28,29]),('March',[31]), ('April',[30]),('May',[31]),('June',[30]),('July',[31]),('August',[31]), ('September',[30]),('October',[31]),('November',[30]),('December',[31]) ] def days_in_month(month): global month_days return filter(lambda x: x[0] == month, month_days)[0][1] If you are using Python 3.x remember to add 'from functools import filter' at the top of the file. |
| Re: Help Me With My Python. by Nobody: 8:11am On Jan 28, 2015 |
help with your python keh ? make e bite us abi ? |
| Re: Help Me With My Python. by fattbabakay(m): 10:56am On Jan 28, 2015 |
bb6xt: |
| Re: Help Me With My Python. by lordZOUGA(m): 3:21pm On Jan 28, 2015*. Modified: 8:34pm On Jan 28, 2015 |
month_days= [('January',[31]),('February',[28,29]),('March',[31]), ('April',[30]),('May',[31]),('June',[30]),('July',[31]),('August',[31]), ('September',[30]),('October',[31]),('November',[30]),('December',[31]) ] def days_in_month(month): return dict(month_days)[month] that should be enough for you purposes. BlowJobs. |
| Re: Help Me With My Python. by Nastydroid(m): 11:18pm On Jan 28, 2015*. Modified: 9:31am On Jan 29, 2015 |
BlowJobs:I will drop an example and you will Use the idea >>>def name_and_age(name): Name_and_age={'nastydroid':'17','name:'34','phython':'21'} Print(name_and_age[name]) >>> name_and_age('python') Nb:Am using a Mobile phone, |
| Re: Help Me With My Python. by tinnyailes(m): 1:01pm On Nov 24, 2017 |
Hello sir pls I really need your help with something important I'd be glad if you could reach me on whatsapp 08176812097 or via my mail msremmurd@gmail.com |
My Python Guessing Game... Pythonistas Please Come In • Please Help With My Python Shopping Cart Script • Check Out My Python-kivy Game Hosted On Github... • 2 • 3 • 4
Java: Which Is Better To Use Jaxb Or Stax • How I Built A Nairaland Web Scraper • Mason: A Java Json Parser That Works
