Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Troubles with program
Post: RE: Troubles with program
import random
number=sorted(random.sample(range(1,1501),100))
for i in number:
letters=sorted(random.sample('abcdefgh',4))
print(str(i) + '.' + ' ' + ','.join(letters))Finally!
Edit: Haha, di... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 05:05 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
(May-28-2020, 02:26 PM)pyzyx3qwerty Wrote: @Harambe it is recommended you use Python 3 though - Python 2 isn't supported anymore
I wanted to but my iPad has problems with the new version **biggrin*... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 04:37 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
I would never do it without your help lol. Mainly the 6th line. But I still dont understand how did we prevent numbers to generate unique... And how to sort them like the letters. I tried to use “sort... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 01:58 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
(May-28-2020, 01:41 PM)GOTO10 Wrote: I haven't used Python 2 (and I believe it is now deprecated), but maybe someone else can help us figure that out.
If you want to try the code in Python 3, you c... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 01:44 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Python2IDE on iPad. I used 3, but it started to crash a lot.
Btw. I found the command
reverse=True to sort the numbers in ascending order but I am not sure how to implement it. |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 01:40 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Its actually your code. I tried to modify it but no change. When I changed coma in between apostrophes it just changed the thing between letters. Nothing happened with numbers.
import random
for i i... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 01:32 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Output:(714, 'b,c,d,e')
(616, 'e,f,g,h')
(1006, 'a,c,d,g')
(71, 'a,e,f,h')
(493, 'a,d,f,g')
(1184, 'b,c,e,g')
...Still the same problem with ‘ and (). And one more thing, I dont understand why it writ... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 01:27 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Almost got it! This command helped me a lot! I am wondering I didnt find it on the internet.
import random
number=random.sample(range(1500),1)
letters=random.sample(['a','b','c','d','e','f','g','h'],4... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 12:52 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
import random
number=random.randrange(1500)+1
letter=random.choice(['a','b','c','d','e','f','g','h'])
dot='.'
for i in range(100):
number=random.randrange(1500)+1
letter1=random.choice(['a','b... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 11:49 AM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Yes, in ascending order. Meanwhile I was thinking about this:
import random
number=random.randrange(1500)+1
letter=random.choice(['a','b','c','d','e','f','g','h'])
dot='.'
for i in range(100):
num... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 11:04 AM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Thank you for advice, but I need output like this:
Output:21. a,f,g,h
45. b,c,e,g
77. a,d,f,h
394. b,c,d,g
...It would be nice if there is any poissibility to sort the numbers and letters in the order... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 10:25 AM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Good news! I did something like this:
import random
import string
number=random.randrange(1500)+1
letter=random.choice(['a','b','c','d','e','f','g','h'])
dot='.'
for i in range(100):
number=random... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 10:04 AM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
import random
import string
number=random.randrange(1500)+1
letter=random.choice(['a','b','c','d','e','f','g','h'])
for i in range(100):
number=random.randrange(1500)+1
letter=random.choice(['... |
|
Harambe |
Homework |
37 |
9,599 |
May-28-2020, 09:25 AM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
import random
number=random.randrange(1500)+1
print(f"number: {number}")
letter=['a','b','c','d','e','f','g','h']
for i in range(100):
number=random.randrange(1500)+1
print(number)Wha... |
|
Harambe |
Homework |
37 |
9,599 |
May-27-2020, 11:25 PM |
|
|
Thread: Troubles with program
Post: RE: Troubles with program
Yes, cause I really dont know what to do next. It is just a laic research from youtube and internet. Honestly, I dont even know what did I write. |
|
Harambe |
Homework |
37 |
9,599 |
May-27-2020, 11:09 PM |
|
|
Thread: Troubles with program
Post: Troubles with program
Hello!
I am a student and I am learning for my admission test to the university and I was wondering if there is any possibility to create any “light” program to test myself before the exam day. The pr... |
|
Harambe |
Homework |
37 |
9,599 |
May-27-2020, 10:38 PM |