Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

print string odd elements in python

given_string = input('Enter a string: ')

even_chars = []
odd_chars = []

for i in range(len(given_string)):
    if i % 2 == 0:
        even_chars.append(given_string[i])
    else:
        odd_chars.append(given_string[i])

print('Odd characters: {}'.format(odd_chars))
print('Even characters: {}'.format(even_chars))
Comment

PREVIOUS NEXT
Code Example
Typescript :: typescript switch test per case 
Typescript :: setup express with typescript 
Typescript :: typescript html input 
Typescript :: react router dom move to another page 
Typescript :: how to know if window exists in nodejs 
Typescript :: how to use command line arguments in java eclipse 
Typescript :: angular navigate using component 
Typescript :: compare two objects deep 
Typescript :: typescript object.keys 
Typescript :: http requests in spring boot 
Typescript :: react native typescript 
Typescript :: run typescript node 
Typescript :: @babel/preset-typescript 
Typescript :: typescript type guard function 
Typescript :: how to register assets in flutter 
Typescript :: circle dot in latex 
Typescript :: components meaning 
Typescript :: how to get post of instragram using api 
Typescript :: after effects free download 
Typescript :: list of environment python 
Typescript :: npm dotenv typescript 
Typescript :: styled components if else 
Typescript :: google fonts for flutte 
Typescript :: react typescript props 
Typescript :: angular append array to another 
Typescript :: python convert a csv to a tsv 
Typescript :: select column values from array typescript 
Typescript :: React.ComponentProps<T 
Typescript :: typescript jsx element 
Typescript :: angular typescript filter array group by attribute 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =