Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 174e0ff

Browse files
Add or modify some files.
1 parent e0091a7 commit 174e0ff

3 files changed

+17
-8
lines changed

‎35. Write a program to check whether the string is palindrome string or not.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88
def isPalindrome(sTr):
9-
if sTr[::-1] == sTr:
9+
if sTr[-1::-1] == sTr:
1010
print('The String is a palindrome string.')
1111
else:
1212
print('The String is not palindrome. ')
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1+
'''
2+
Description:
3+
Description is mentioned below with the help of comments in roman urdu.
4+
'''
5+
16
# 1st Method:
27

38
# text = input('Enter String to find its reverse: ').casefold()
49
# print('The reverse of a string is',text[-1::-1])
510

611
# 2nd method:
712

8-
# text = 'ram' # 2 se start lega or -1 tak jaiga matlb -1 se ek ziyada matlb 0 tak jaiga
9-
# # or har dafa ek ka decrement hoga.
13+
# text = 'ram'
14+
# 2 se start lega or -1 tak jaiga matlb -1 se ek ziyada matlb 0 tak jaiga
15+
# or har dafa ek ka decrement hoga.
16+
# i ki value jab -1 to program terminate because ek ziyada tak chalta hai or 0 tak jaiga isliye
17+
# -1 or -1 clash or program terminate.
1018
# for i in range((len(text)-1), -1, -1):
1119
# print(text[i], end='')
1220

1321
# 3rd method:
1422

15-
text = 'ram'
16-
print(text[-1:-4:-1])
23+
# text = 'ram'
24+
# print(text[-1:-4:-1])

‎47. Write a program that counts total vowels and consonants in a string.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'''
2-
Casefold is basically method that turns the string into lower case format.
2+
Casefold is basically a method that turns the string into lower case format.
33
'''
44

5-
text = input('Enter string: ').casefold()
5+
text = input('Enter string: ')
66
vowel = 0
77
consonant = 0
88
for i in range(0, len(text)):
99
if text[i] != '':
10-
if text[i] == 'a' or text[i] == 'e' or text[i] == 'i' or text[i] == 'o' or text[i] == 'u':
10+
if (text[i] == 'a' or text[i] == 'e' or text[i] == 'i' or text[i] == 'o' or text[i] == 'u'
11+
or text[i] == 'A' or text[i] == 'E' or text[i] == 'I' or text[i] == 'O' or text[i] == 'U'):
1112
vowel += 1
1213
else:
1314
consonant += 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /