programming in python

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 1000 and 7000 (both included). The numbers obtained should be printed in a comma-separated sequence on a single line. Hint: Consider the use of range(#begin, #end) use python languaue

in progress 0
Python 4 weeks 1 Answer 120 views 0

About jesus

Answer ( 1 )

  1. rg123

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    You have provided some hints, why you are not trying yourself?

    for x in range(1000, 7000):
            if (a%7)==0:
                    b=a/5.0
                    if (b%5)!=0:
                            print(str(a)+",",end='')
    

    Output :
    1001,1008,1015,1022,1029,1036,1043,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1582,1589,1596,1603,1610,1617,1624,1631,1638,1645,1652,1659,1666,1673,1680,1687,1694,1701,1708,1715,1722,1729,1736,1743,1757,1764,1771,1778,1785,1792,1799,1806,1813,1820,1827,1834,1841,1848,1855,1862,1869,1876,1883,1890,1897,1904,1911,1918,1932,1939,1946,1953,1960,1967,1974,1981,1988,1995,2002,2009,2016,2023,2030,2037,2044,2051,2058,2065,2072,2079,2086,2093,2107,2114,2121,2128,2135,2142,2149,2156,2163,2170,2177,2184,2191,2198,2205,2212,2219,2226,2233,2240,2247,2254,2261,2268,2282,2289,2296,2303,2310,2317,2324,2331,2338,2345,2352,2359,2366,2373,2380,2387,2394,2401,2408,2415,2422,2429,2436,2443,2457,2464,2471,2478,2485,2492,2499,2506,2513,2520,2527,2534,2541,2548,2555,2562,2569,2576,2583,2590,2597,2604,2611,2618,2632,2639,2646,2653,2660,2667,2674,2681,2688,2695,2702,2709,2716,2723,2730,2737,2744,2751,2758,2765,2772,2779,2786,2793,2807,2814,2821,2828,2835,2842,2849,2856,2863,2870,2877,2884,2891,2898,2905,2912,2919,2926,2933,2940,2947,2954,2961,2968,2982,2989,2996,3003,3010,3017,3024,3031,3038,3045,3052,3059,3066,3073,3080,3087,3094,3101,3108,3115,3122,3129,3136,3143,3157,3164,3171,3178,3185,3192,3199,3206,3213,3220,3227,3234,3241,3248,3255,3262,3269,3276,3283,3290,3297,3304,3311,3318,3332,3339,3346,3353,3360,3367,3374,3381,3388,3395,3402,3409,3416,3423,3430,3437,3444,3451,3458,3465,3472,3479,3486,3493,3507,3514,3521,3528,3535,3542,3549,3556,3563,3570,3577,3584,3591,3598,3605,3612,3619,3626,3633,3640,3647,3654,3661,3668,3682,3689,3696,3703,3710,3717,3724,3731,3738,3745,3752,3759,3766,3773,3780,3787,3794,3801,3808,3815,3822,3829,3836,3843,3857,3864,3871,3878,3885,3892,3899,3906,3913,3920,3927,3934,3941,3948,3955,3962,3969,3976,3983,3990,3997,4004,4011,4018,4032,4039,4046,4053,4060,4067,4074,4081,4088,4095,4102,4109,4116,4123,4130,4137,4144,4151,4158,4165,4172,4179,4186,4193,4207,4214,4221,4228,4235,4242,4249,4256,4263,4270,4277,4284,4291,4298,4305,4312,4319,4326,4333,4340,4347,4354,4361,4368,4382,4389,4396,4403,4410,4417,4424,4431,4438,4445,4452,4459,4466,4473,4480,4487,4494,4501,4508,4515,4522,4529,4536,4543,4557,4564,4571,4578,4585,4592,4599,4606,4613,4620,4627,4634,4641,4648,4655,4662,4669,4676,4683,4690,4697,4704,4711,4718,4732,4739,4746,4753,4760,4767,4774,4781,4788,4795,4802,4809,4816,4823,4830,4837,4844,4851,4858,4865,4872,4879,4886,4893,4907,4914,4921,4928,4935,4942,4949,4956,4963,4970,4977,4984,4991,4998,5005,5012,5019,5026,5033,5040,5047,5054,5061,5068,5082,5089,5096,5103,5110,5117,5124,5131,5138,5145,5152,5159,5166,5173,5180,5187,5194,5201,5208,5215,5222,5229,5236,5243,5257,5264,5271,5278,5285,5292,5299,5306,5313,5320,5327,5334,5341,5348,5355,5362,5369,5376,5383,5390,5397,5404,5411,5418,5432,5439,5446,5453,5460,5467,5474,5481,5488,5495,5502,5509,5516,5523,5530,5537,5544,5551,5558,5565,5572,5579,5586,5593,5607,5614,5621,5628,5635,5642,5649,5656,5663,5670,5677,5684,5691,5698,5705,5712,5719,5726,5733,5740,5747,5754,5761,5768,5782,5789,5796,5803,5810,5817,5824,5831,5838,5845,5852,5859,5866,5873,5880,5887,5894,5901,5908,5915,5922,5929,5936,5943,5957,5964,5971,5978,5985,5992,5999,6006,6013,6020,6027,6034,6041,6048,6055,6062,6069,6076,6083,6090,6097,6104,6111,6118,6132,6139,6146,6153,6160,6167,6174,6181,6188,6195,6202,6209,6216,6223,6230,6237,6244,6251,6258,6265,6272,6279,6286,6293,6307,6314,6321,6328,6335,6342,6349,6356,6363,6370,6377,6384,6391,6398,6405,6412,6419,6426,6433,6440,6447,6454,6461,6468,6482,6489,6496,6503,6510,6517,6524,6531,6538,6545,6552,6559,6566,6573,6580,6587,6594,6601,6608,6615,6622,6629,6636,6643,6657,6664,6671,6678,6685,6692,6699,6706,6713,6720,6727,6734,6741,6748,6755,6762,6769,6776,6783,6790,6797,6804,6811,6818,6832,6839,6846,6853,6860,6867,6874,6881,6888,6895,6902,6909,6916,6923,6930,6937,6944,6951,6958,6965,6972,6979,6986,6993,

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>