how to make a program with a certain number of multiples?
 how to make a program with a certain number of multiples? syafiq14 Programmer named Tim Posts: 12 Threads: 9 Joined: Dec 2019 Reputation: Jan-01-2020, 12:48 PM how to make a program if it met with certain multiples of these numbers will produce a different output example: I have numbers 1 - 20 these numbers will have the same output except 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 plus the string in front to distinguish that they are multiples of 2 besides their multiples of 2 only has regular integer output. output: 1 2 different 3 4 different 5 6 different 7 8 different 9 10 different etc how do you make the program? I've tried using a for loop and range function with an if statement but it still produces output that doesn't match what I want Reply Posts: 1,144 Threads: 41 Joined: Sep 2016 Reputation: Jan-01-2020, 01:37 PM Hello, post the code which you used (in [python] code tags). It's quite likely that your code is close to solution you want, just need a little tweaking. You can also post the output of your current code (in [output] tags). Reply sandeep_ganga Not Blown Up Yet Posts: 50 Threads: 2 Joined: Nov 2019 Reputation: Jan-01-2020, 01:50 PM Try below to see if that helps, ```x=int(input("enter max numbers to test: ")) y=int(input("multiple of whihc number to be different: ")) i=1 while (i <= x ): if ( i % y == 0 ): print("--->", i) else: print(i) i += 1 ```Best Regards, Sandeep GANGA SANDEEP KUMAR Reply syafiq14 Programmer named Tim Posts: 12 Threads: 9 Joined: Dec 2019 Reputation: Jan-01-2020, 02:39 PM (This post was last modified: Jan-01-2020, 02:51 PM by syafiq14.) (Jan-01-2020, 01:50 PM)sandeep_ganga Wrote: Try below to see if that helps, ```x=int(input("enter max numbers to test: ")) y=int(input("multiple of whihc number to be different: ")) i=1 while (i <= x ): if ( i % y == 0 ): print("--->", i) else: print(i) i += 1 ```Best Regards, Sandeep GANGA SANDEEP KUMAR Thank you for your help :) (Jan-01-2020, 01:37 PM)j.crater Wrote: Hello, post the code which you used (in [python] code tags). It's quite likely that your code is close to solution you want, just need a little tweaking. You can also post the output of your current code (in [output] tags). Alright, thanks for the advice Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Help making number analysis program Dainer 2 203 Jun-24-2021, 09:55 PM Last Post: jefsummers How to make a Vocal synthesizer program on Python? Seadust 3 778 Jan-28-2021, 06:26 PM Last Post: gonnach I want to create small multiples grouped bar plot, and facing some aesthetics issuess dev_kaur 0 348 Dec-05-2020, 08:49 AM Last Post: dev_kaur How to make a Python program run in a dos shell (cmd) Pedroski55 2 564 Nov-09-2020, 10:17 AM Last Post: DeaD_EyE multiprocess hang when certain number is used in the program esphi 7 785 Nov-06-2020, 03:49 PM Last Post: esphi I try to make Heron formula program abcd 7 736 Oct-22-2020, 12:48 AM Last Post: abcd Make a Python program executable in Windows Pedroski55 1 581 Sep-26-2020, 12:34 AM Last Post: bowlofred Make an array of string number in a List polantas 5 1,100 May-27-2020, 07:18 AM Last Post: buran Read Multiples Text Files get specific lines based criteria zinho 5 1,062 May-19-2020, 12:30 PM Last Post: zinho I code a program to solve puzzle but i can't make it more dynamic. Shahmadhur13 5 1,030 Apr-18-2020, 10:05 AM Last Post: Shahmadhur13

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020