0% found this document useful (0 votes)
3 views2 pages

assignments_day1

The document provides a series of programming tasks for users to practice Python input and string manipulation. Tasks include calculating BMI, replacing characters in strings, computing interest, formatting city names, finding character indices, counting letters in a string, and creating email aliases. Each task emphasizes user input and string methods, with examples provided for clarity.

Uploaded by

nikkigupta13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

assignments_day1

The document provides a series of programming tasks for users to practice Python input and string manipulation. Tasks include calculating BMI, replacing characters in strings, computing interest, formatting city names, finding character indices, counting letters in a string, and creating email aliases. Each task emphasizes user input and string methods, with examples provided for clarity.

Uploaded by

nikkigupta13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Note 1: when taking user input using input() you can pass prompt to the user

example
name=input("enter your name: ")

Note 2: For assignments you might need to use some of the string methods that were
not discussed in class. You can refer to below link for reference:

https://www.w3schools.com/python/python_ref_string.asp

1- write a program which takes 2 inputs from the user : weight(kg) and
height(meter) and prints the BMI in the output.

BMI = weight / (square of height)

2- write a program which takes the name of the user as input and replace all the
occurence of character 'a' in the name to 'b' and print it.

3- write a program which takes 2 inputs from user as principle amount (int) and
rate of annual interest (float) and print the expected total amount after 2
years.

example : principle : 100 , interest percent 10 then amount after 2 years will
be : 100*1.1*1.1 = 121

4- write a program which takes city name from user input. irrespective of in which
case user enters the city name, print the city name in camel case meaning first
letter should be capital and rest in small.

example : input : MYSORE , print - > Mysore

5- write a program which takes the name of the user as input and print the index of
character 'a' in the string. if 'a' is not there then return -1.

6- Display the number of letters in the below string


my_word = "antidisestablishmentarianism"

7- take 3 inputs from user : first name , last name and age . Display the
information in below format
exmaple
first name : MOhit
last name : sharma
age 32

Display : my name is Mohit Sharma and I am 32 years old.

note that first letter of first name and last name both should be in capital
letters and rest in small.

8-take 3 inputs from user : first name , last name and company name. create the
email alias for the user and display it. Email alias is first 2 letters of first
name , last 3 letters of last name and @company.com
example
first name : MOhit
last name : sharma
company : infosys
Display : [email protected]

note full email id should -be in lower case

You might also like