Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 create three digit numbers Krszt Programmer named Tim Posts: 19 Threads: 10 Joined: Oct 2018 Reputation: 0 Likes received: 0 #1 Dec-08-2018, 08:30 PM Hello! I would like to get all the 3 digit numbers where, the digit on the right side is equal or bigger than the previos one (on its left). Like: 112, 122,123 are okay but 132 is not good. Could you give some hint to get all the combinations? Thank you Gribouillis Posts: 1,436 Threads: 8 Joined: Jan 2018 Reputation: 128 Likes received: 343 #2 Dec-08-2018, 08:47 PM What have you tried? Shouldn't this be in the 'homework' section? micseydel likes this post Krszt Programmer named Tim Posts: 19 Threads: 10 Joined: Oct 2018 Reputation: 0 Likes received: 0 #3 Dec-09-2018, 12:07 PM (This post was last modified: Dec-12-2018, 04:11 AM by micseydel. Edited 1 time in total. Edit Reason: Merged this post from a new thread created in Homework. ) Hello! I would like to get all the 3 digit numbers where, the digit on the right side is equal or bigger than the previos one (on its left). Like: 112, 122,123 are okay but 132 is not good. Could you give some hint to get all the combinations? Thank you Axel_Erfurt Spam, spam, eggs, and spam Posts: 201 Threads: 10 Joined: Dec 2016 Reputation: 11 Likes received: 21 #4 Dec-09-2018, 02:50 PM create a digit numbers list and ask for ```mydigits = [112, 122, 123] the_digit = input('Enter Digit:\n') if int(the_digit) in mydigits: print('Digit OK') else: print('Digit not OK') ``` Gribouillis likes this post ThePhi Programmer named Tim Posts: 9 Threads: 2 Joined: Dec 2018 Reputation: 0 Likes received: 1 #5 Dec-09-2018, 03:12 PM (This post was last modified: Dec-09-2018, 03:14 PM by ThePhi. Edited 1 time in total.) like this?: ```result = [] for nb in range(100,1000): nb_str = str(nb) if int(nb_str[0]) <= int(nb_str[1]) and int(nb_str[1]) <= int(nb_str[2]): result.append(nb) print(result) ``` « Next Oldest | Next Newest »

Top Page

 Possibly Related Threads... Thread Author Replies Views Last Post integer representing a 10-digit phone number critter70 5 103 May-17-2019, 09:29 AM Last Post: saravanatn Four-digit number text translation. soz 3 79 May-13-2019, 03:02 PM Last Post: buran Turning column of 8 digit numbers into three seperate columns Wade334 1 87 May-11-2019, 02:52 PM Last Post: Larz60+ Sum of digit in a string MEH012 1 1,433 Apr-20-2018, 02:13 AM Last Post: Larz60+ Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 1,086 Dec-05-2017, 09:48 AM Last Post: DeaD_EyE Allow only digit penoxcz 3 1,069 Nov-14-2017, 03:04 PM Last Post: wavic Four digit combinations EHod 4 1,568 Aug-13-2017, 09:14 PM Last Post: EHod create a 20 digit string, and cast to a list then add all the digits as integers nikhilkumar 2 1,402 Jul-19-2017, 04:53 PM Last Post: nilamo

Forum Jump:

Users browsing this thread: 1 Guest(s)