w3resource

Python: Create all possible strings by using a, e, i, o, u

Python Basic - 1: Exercise-2 with Solution

Write a Python program to create all possible strings by using 'a', 'e', 'i', 'o', 'u'. Use the characters exactly once.

Pictorial Presentation:

Python: Create all possible strings by using a, e, i, o, u

Sample Solution:

Python Code :

import random
char_list = ['a','e','i','o','u']
random.shuffle(char_list)
print(''.join(char_list))

Sample Output:

iauoe

Flowchart:

Flowchart: Python - Create all possible strings by using a, e, i, o, u

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor :

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python function that takes a sequence of numbers and determines if all the numbers are different from each other.
Next: Write a Python program to remove and print every third number from a list of numbers until the list becomes empty.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz



Python: Tips of the Day

Python: Use Enumerate() In for Loops

>>> students = ('John', 'Mary',  'Mike')
>>> for i, student in enumerate(students):
  ...     print(f'Iteration:  {i}, Student: {student}')
  ... 
Iteration: 0, Student: John
Iteration: 1, Student: Mary
Iteration: 2, Student: Mike
>>> for i, student in enumerate(students,  35001):
  ...      print(f'Student Name: {student}, Student ID #: {i}')
  ... 
Student Name: John, Student ID #: 35001
Student Name: Mary, Student ID #: 35002
Student Name: Mike, Student ID #: 35003