Python Progamming
Python Progamming
4. Write a python script to print the current date in the following format
“Sun May 29 02:26:23 IST 2017”
Output:
20. Write a Python class to reverse a string word by word.
Firstly, I have created a class called Reverse
After that, we have defined the function inside the class
Now, we will split the sentence into a list of words, and to
form the new sentence join() is used for joining the words in
the list.
At last, print Reverse().reverse_word(‘Welcome to
Python’) to get the output.
Output:
28. Python program to interchange first and last elements in a list
Output:
31. Convert a list of Tuples into Dictionary