CodeSolved

A comprehensive source of programming questions and exercises

Sorting by alphabet

Practice Easy 847/ Download 1372 Views

Write a program that receives a number of names from the input and then arranges them based on alphabetic letters and prints in the output

12 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
names = [] # List for names
while True: # As long as
    name_user = input('please enter your names: ') # Get input from the user
    if name_user == '':
        break
    else:
        names.append(name_user)
names.sort()
print(names)
Amirgr Download Python
names_list = []
for i in range (10):
    names_list.append(input('Enter name : '))
names_list.sort()
print(names_list)
names = []
while True:
    user_input = input("Please enter a name: (enter to exit)")
    if user_input == "":
        break
    else:
        names.append(user_input)
names.sort()
print(f"Sorted name => {names}")
Behcoder Download Python
names=[]
while True:  
    name = input("inter your names: ")  
    if name.lower() == 'end':  
        break   
    names.append(name)
print(sorted(names))
User 943 Download Python
# Get names and sorting by alphabet
x = input('please enter name with - seprator:')
x = x.lower() # Sorting to size and small letters are sensitive
x= x.split('-')
x.sort() # Make sure you do not push the sorting command into the variable
for item in x:
    print(item)
Alvandsina Download Python
asami = []
while 1:
    names = input("please enter a name: ")
    if names == 0:
        break
    elif names.isalpha():
        asami.append(names)
    else:
        print(sorted(asami))
list_names=[]
while True:
        x=str(input("x: "))
        list_names.append(x)
        if x=="":
                list_names.remove("")
                break
abcd = sorted(list_names)
print(abcd)
Farbod.313 Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close