/python

python training

Primary LanguagePython

Python (day 1)

Decision making (done) 1.Calculate tax payable for a given income. Prompt user to enter a positive number. 2.Prompt user to enter a value between 1 to 100 and print out the grade based on rules below # >= 90 and <= 100 : Grade A # >= 80 and < 90 : Grade B # >= 70 and < 80 : Grade C # < 70 : Grade F 3.Prompt user to enter an year and print out if it is a leap year or not. 4.Python program to check if the input number is odd or even.

Lists (done)

1.Display a histogram using values from a list. Use # as the  character.
2.For a given list, generate a list containing squares of even items in list
3.For a given list, generate a list containing squares of the items in list that are greater than 10 and less than 50
4.Generate a list containing squares of the numbers 0-9
5.Please write a program to generate all sentences where subject is in ["I", "You"] and verb is in ["Play", "Love"]
   and the object is in ["Hockey","Football"].

Loops (done) 1.Python program to check if the number is an Armstrong number or not 2.Prompt user to enter a number and print out all the odd, even numbers between 0 and the number separately on two 3.Prompt user to enter a number and print out its factorial (using looping). 4.Prompt user to enter a number and print out fibonacci sequence up to that number. 5.Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. 6.Python Program to Display the multiplication Table 7.print all elements in a list print all even index elements in a list print all odd index elements in a list 8.Reverse a Number using a while loop

Modules (done) 1.Prompt user to enter year, month values and print the calender for the combination. Hint: Refer to Calender module. 2.Print the current date and time. 3.Write a python program to calculate no.of days between 2 dates. Sample dates: (2014,7,2) , (2014, 7, 11) Expected output: 9 days 4.Program to Shuffle Deck of Cards (itertools, random)

Strings (done) 1.Python Program to Find ASCII Value of Character. 2.Program to find whether a string is a palindrome. 3.Create a function in Python that accepts a string and the python must return a string with each character in the original string doubled. If you send the “now” function as a parameter it must return “nnooww,”. If you send “123a!”, it must return “112233aa!!”. 4.Python Program to Get a Substring of a String my_string = "I love python." a) prints "love" b) prints "love python." c) prints "I love python"

Tuples (done) 1.Prepare a list of tuples by pairing each element from second list with element from first list.

If you doubts or clarifications please let me know