Skip to content

Python Exercise I

Muhammad Zeeshan Babar edited this page Nov 3, 2022 · 1 revision

Exercise

Task 1

Print characters from a string (take input from user) that are present at an even index number

Task 2

Initialize two lists,

  • Check if the first and last number of both lists (minimum 6 numbers) are the same.
  • Comapre two lists and print out the common numbrs.

Task 3

Write a code to print all Prime numbers less than 100.

Task 4

Print the following pattern

1 
2 2 
3 3 3 
4 4 4 4 
5 5 5 5 5

Task 5

Display numbers from a list using loop. Write a program to display only those numbers from a list [10, 50, 100, 124, 150, 200, 441, 475, 449, 550] that satisfy the following conditions

The number must be divisible by five If the number is greater than 450, then skip it and move to the next number If the number is greater than 500, then stop the loop

Task 6

Write a program to print the following start pattern using the for loop

* 
* * 
* * * 
* * * * 
* * * * * 
* * * * 
* * * 
* * 
*

Clone this wiki locally