CSIR12 Introduction to computer programming
B.Tech Civil Engineering, Section A
Date: 1st Mar 2024
Exercise 4: Nested Loop and String Methods
Write Algorithms and execute the following programs.
1. Write a python program to print 1 to 10 multiplication table using Nested Loop.
2. Write a program to print the following with single space in-between characters,
a) *
* *
* * *
* * * *
* * * * *
b) *
* *
* * *
* * * *
3. Write a program to print the following with single space in-between characters
a) 1
12
123
1234
b) 1
22
333
4444
4. Write a program to get a string input and then display number of characters in the string,
last (or max) index value and character in the string.
5. Write a program to display the odd index value and the corresponding characters in the
string (Example: for string “Hello”, the odd indexed value is 1,3 (max index for Hello is 4) and
display the corresponding characters ‘e’ and ‘l’)
a) Python developers
b) Introduction to computer programming
6. Find the no. of times a letter ‘h’ occurs in a text, “happy hour”.
7. Find the index of the second occurrence of the letter h in the above text.
8. Find the index of third occurrence of e in ‘Developers’.