Skip to content

Latest commit

 

History

History
48 lines (40 loc) · 2.74 KB

File metadata and controls

48 lines (40 loc) · 2.74 KB

Exercise Questions.

This document will be updated regularly

  1. Take the input of two numbers and perform arithematic operations on it and print output as shown in the image.

output: exercise

  1. Find the sum of first n positive integers.
  2. Identify the email service providers for the list of email ids.
emails = ['test1@gmail.com','test2@outlook.com','test3@yahoo.com','test4@gmx.com','test4@mail.com','test4@post.com']
  1. Create a list of city name with STD code from the provided string below using str.strip module.
STRING DATA:
std_code = "11 Delhi, 22 Mumbai, 33 Kolkata, 44 Chennai, 40 Hyderabad, 80 Bangalore, 20 Pune, 79 Ahmedabad"

LIST OUTPUT:
std_code_list['11 Delhi', ' 22 Mumbai', ' 33 Kolkata', ' 44 Chennai', ' 40 Hyderabad', ' 80 Bangalore', ' 20 Pune', ' 79 Ahmedabad']
  1. Create a dictionary from the list (output of exercise 4). keys should be city name and data should be STD code.
Dictionary output:
{'Delhi': 11, 'Mumbai': 22, 'Kolkata': 33, 'Chennai': 44, 'Hyderabad': 40, 'Bangalore': 80, 'Pune': 20, 'Ahmedabad': 79}
  1. Print even numbers for the range provided by the user.

  2. Print multiplication table from 15 to 20.

  3. Find the Sum of Digits in a Number.

     Eg: number = 256
     Solution = 2+5+6 = 13
    
  4. Display the Fibonacci Sequences up to nth Term Where n is Provided by the User.

    Hint: In a Fibonacci sequence, the next number is obtained by adding the previous two numbers. The first two numbers of the Fibonacci sequence are 0  and 1.
    
  5. Check Whether a Number Is Prime or Not.


Follow me on facebook Twitter Telegram GitHub Youtube