check if it contains only vowels. Using Python

Posted on | Wednesday, 17 May 2023 | No Comments

 Given a string, check if it contains only vowels.

Input Format

Input contains a string S, consisting of lowercase and uppercase characters.

Constraints

1 <= len(S) <= 100

Output Format

Print "Yes" if string contains only vowels, "No" Otherwise.

Sample Input 0

SmartInterviews

Sample Output 0

No
vcount = 0;  
ccount = 0;  
str = input()
   
str = str.lower();  
for i in range(0,len(str)):   
        if str[i] in ('a',"e","i","o","u"):  
        vcount = vcount + 1;  
    elif (str[i] >= 'a' and str[i] <= 'z'):  
        ccount = ccount + 1;  
if ccount==0:
    print("Yes")
else :
    print("No")

Print unique elements of the array in the same order as they appear in the input. Using Python

Posted on | Sunday, 14 May 2023 | No Comments

 Print unique elements of the array in the same order as they appear in the input.

Note: Do not use any inbuilt functions/libraries for your main logic.

Input Format

First line of input contains a single integer N - the size of array and second line contains array elements.

Constraints

1 <= N <= 100
0 <= ar[i] <= 109

Output Format

Print unique elements of the array.

Sample Input 0

7
5 4 10 9 21 4 10

Sample Output 0

5 9 21
k=int(input())
b=[]
a=list(map(int,input().split()))
for i in range(k):
    for j in range(k):
        if a[j]==a[i] and j!=i:
            b.append(a[i])

r = [i for i in a if i not in b]
for i in range(len(r)):
    print(r[i],end=" ")

Search

Followers