Python project
Budget: ₹600 – ₹1,500 INR
1. Write a Python program to change the last value from each tuple to 100 from the following list of tuples:
l = [(30, 40, 50), (12, 24, 36), (30, 60, 90)]
Expected output : l = [(30, 40, 100), (12, 24, 100), (30, 60, 100)]
2. Write a Python Program for the following:
Consider the following tuple:
t = (10, 29, 40, 38, 33, 50, 23, -35, -50, 60)
For each item in tuple, determine if the item is divisible by 10. If so, add the item to a separate tuple and print the resultant tuple.
Remember, you cannot add or append items to a tuple. You’ll have to create a list first.
Expected output : (10, 40, 50, -50, 60)
l = [(30, 40, 50), (12, 24, 36), (30, 60, 90)]
Expected output : l = [(30, 40, 100), (12, 24, 100), (30, 60, 100)]
2. Write a Python Program for the following:
Consider the following tuple:
t = (10, 29, 40, 38, 33, 50, 23, -35, -50, 60)
For each item in tuple, determine if the item is divisible by 10. If so, add the item to a separate tuple and print the resultant tuple.
Remember, you cannot add or append items to a tuple. You’ll have to create a list first.
Expected output : (10, 40, 50, -50, 60)
Related categories:
C Programming
Business, Accounting, Human Resources & Legal
Python
Coding
Programming