logo codesdope
Level 1
1.
Take input of length and breadth of a rectangle from user and print area of it.
Answer
print "Enter length"
length = input()
print "Enter Breadth"
breadth = input()
print length*breadth
									

2.
Ask user to give two float input for length and breadth of a rectangle and print area type casted to int.
Answer
print "Enter length"
length = raw_input()
print "Enter Breadth"
breadth = raw_input()
print int(float(length)*float(breadth))
									

3.
Take side of a square from user and print area and perimeter of it.
Answer
print "Enter side"
side = input()
print "Area is",side*side
print "Perimeter is",4*side
									

4.
Take name, roll number and filed of interest from user and print in the format below :
Hey, my name is xyz and my roll number is xyz. My field of interest are xyz.
Answer
print "Enter name"
name = raw_input()
print "Enter roll number"
roll = input()
print "Field of interests"
interest = raw_input()
print "Hey, my name is",name,"and my roll number is",roll,". My field of interests are",interest
									

5.
Write a program to find square of a number.
E.g.-
INPUT : 2        OUTPUT : 4
INPUT : 5        OUTPUT : 25
Answer
print "Enter number to find the square of it"
number = input()
print number**2
									

6.
Take two different string input and print them in same line. E.g.-
INPUT : Codes
Dope
OUTPUT : CodesDope
Answer
print "Enter first string"
first = raw_input()
print "Enter seconnd string"
second = raw_input()
final = first+second
print final
									
Doubt? Ask question
Close

Welcome.please sign up.

Close

Welcome.please login.