Python Assignment
Python Assignment
1.WriteaPythonprogramtocountthenumberofevenandoddnumbersfromaseriesofnumbers.
amplenumbers:numbers=(1,2,3,4,5,6,7,8,9)
2.WriteaPythonprogramtoconstructthefollowingpattern,usinganestedforloop.
*
**
***
****
*****
****
***
**
*
3. WriteaPythonprogramtogettheFibonacciseriesbetween0to50.
Note:TheFibonacciSequenceistheseriesofnumbers:
0,1,1,2,3,5,8,13,21,....
Everynextnumberisfoundbyaddingupthetwonumbersbeforeit.
4. WriteaPythonprogramwhichiteratestheintegersfrom1to50.Formultiplesofthreeprint"Fizz"insteadofthenumberand
forthemultiplesoffiveprint"Buzz".Fornumberswhicharemultiplesofboththreeandfiveprint"FizzBuzz".
5.WriteaPythonprogramwhichtakestwodigitsm(row)andn(column)asinputandgeneratesatwodimensionalarray.The
elementvalueintheithrowandjthcolumnofthearrayshouldbei*j.
Note:
i=0,1..,m1
j=0,1,n1.
TestData:Rows=3,Columns=4
6.WriteaPythonprogramwhichacceptsasequenceofcommaseparated4digitbinarynumbersasitsinputandprintthe
numbersthataredivisibleby5inacommaseparatedsequence.GototheeditorSampleData:0100,0011,1010,1001,1100,1001
7.WriteaPythonprogramthatacceptsastringandcalculatethenumberofdigitsandletters.GototheeditorSampleData:
Python3.2
8.WriteaPythonprogramtoprintalphabetpattern'A'.
9. WriteaPythonprogramtocheckatriangleisequilateral,isoscelesorscalene.
Note:
Anequilateraltriangleisatriangleinwhichallthreesidesareequal.
Ascalenetriangleisatrianglethathasthreeunequalsides.
Anisoscelestriangleisatrianglewith(atleast)twoequalsides.
10.WriteaPythonprogramthatreadstwointegersrepresentingamonthanddayandprintstheseasonforthatmonthandday.
11.WriteaPythonprogramtodisplayastrologicalsignforgivendateofbirth.
12. WriteaPythonprogramtodisplaythesignoftheChineseZodiacforgivenyearinwhichyouwereborn
13.WriteaPythonprogramtocreatethemultiplicationtable(from1to10)ofanumber.
14.WriteaPythonprogramtocheckwhetheranalphabetisavowelorconsonant.
15. WriteaPythonprogramtocalculateadog'sageindog'syears.
Note:Forthefirsttwoyears,adogyearisequalto10.5humanyears.Afterthat,eachdogyearequals4humanyears..
16.WriteaPythonprogramtocheckthevalidityofpasswordinputbyusers
Validation:
Atleast1letterbetween[az]and1letterbetween[AZ].
Atleast1numberbetween[09].
Atleast1characterfrom[$#@].
Minimumlength6characters.
Maximumlength16characters.
17. WriteaPythonprogramthatprintseachitemanditscorrespondingtypefromthefollowinglist.
SampleList:datalist=[1452,11.23,1+2j,True,'w3resource',(0,1),[5,12],{"class":'V',"section":'A'}]
18.WriteaPythonprogramthatprintsallthenumbersfrom0to6except3and6.
Note:Use'continue'statement.
19.WriteaPythonprogramtoconverttemperaturestoandfromcelsius,fahrenheit.Gototheeditor[Formula:c/5=f32/9
[wherec=temperatureincelsiusandf=temperatureinfahrenheit]
20. WriteaPythonprogramtofindthosenumberswhicharedivisibleby7andmultipleof5,between1500and2700(both
included).