python tips:
*******
WAP for print a character its position times in a word.
Output:
******
WAP for print a character its ASCII values times in a word.
In [1]: os.listdir(os.getcwd())==os.listdir(os.curdir)
Out[1]: True
In [2]: os.listdir(os.getcwd())==os.listdir('.')
Out[2]: True
*******
WAP for print a character its position times in a word.
word=raw_input("Enter the word:")
for i in word:
print i*word.index(i)
Output:
******
WAP for print a character its ASCII values times in a word.
word=raw_input("Enter the word:")
for i in word:
print i*ord(i)
#alternatively # print [i*ord(i) for i in word]
Thank you for sharing this post.
ReplyDeletepython Online Training