Draw a flowchart and construct a python program to accept the monthly income of an employee and display the income tax to be paid at the end of the year according to the following criteria
annual income(in rs) tax
>1000000 4%
> 500000 2%
<= 500000 NIL
Demonstrate use OOP principles, data structures and file handling operations to carry out the following tasks.
a) Define a class named PERSON, with child classes named DAUGHTER and SON who also have derived classes named GRANDSON and GRANDDAUGHTER respectively. All children classes have derived genetic features and skills from PERSON.
Create 5 methods for getting and setting genetic features, setting and getting skills and demonstrate the concept of polymorphism.
b) Modify the answer in a) and show how the PERSON features are captured in a file called person.txt. Also create another method to read from the file person.csv and store the data in a list called persondata.
Clearly show how exceptions are handled in year program.
write a program to count vowels and consonants in string
write a python program to print the following output.
sample input1
bew web
sample output1
Yes
sample input2
race care
sample output2
No
Describe how tuples can be useful with loops over lists and dictionaries, and give Python code examples. Create your own code examples. Do not copy them from the textbook or any other source.
Your descriptions and examples should include the following: the zip function, the enumerate function, and the items method.
Describe how tuples can be useful with loops over lists and dictionaries, and give Python code examples. Create your own code examples. Do not copy them from the textbook or any other source.
Your descriptions and examples should include the following: the zip function, the enumerate function, and the items method.
Max Contiguous Subarray
Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.
Input
The input will contain space-separated integers, denoting the elements of the list.
Output
The output should be an integer.
Explanation
For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,
[2]
[2, -4]
[2, -4, 5]
[2, -4, 5, -1]
[2, -4, 5, -1, 2]
[-4]
[-4, 5]
[-4, 5, -1]
[-4, 5, -1, 2]
[5]
[5, -1]
[5, -1, 2]
[-1]
[-1, 2]
[2]
Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.
Sample Input 1
2 -4 5 -1 2 -3
Sample Output 1
6
Sample Input 2
-2 -3 4 -1 -2 1 5 -3
Sample Output 2
7
Accept two float input from the user, add both numbers and display the result. To convert an input
string value into float use float() function.
Write a program to print table of a number using loop. Take the number from the user.
write a program to print the folllowing word and after the word there is space and after the space word will reversed if it is alphabets are equal in any position before spacing then print "Yes"
sample Input 1
bew web
sample output 1
Yes
sample input 2
race care
sample output 2
No