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

Practicla Record

The document contains a series of Python programming exercises that cover various basic concepts. These include printing natural numbers, calculating sums, finding square roots, computing areas, and handling user input for names and marks. Additionally, it demonstrates creating lists, dictionaries, and a CSV file.
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)
7 views2 pages

Practicla Record

The document contains a series of Python programming exercises that cover various basic concepts. These include printing natural numbers, calculating sums, finding square roots, computing areas, and handling user input for names and marks. Additionally, it demonstrates creating lists, dictionaries, and a CSV file.
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

# 1.Write a python program to print given ‘n’ natural numbers from user.

'''n=int(input("how many numbers"))


for i in range(1,n+1):
print(i)'''

# 2. Write a python program to print sum of the given ‘n’ numbers


'''sum=0
n=int(input("enter number of elements"))
for i in range(n+1):
sum=sum+i
print(sum)'''

#3.Write a python program to print the square root of a given number using library
module
import math
'''n=int(input("enter a number to find square root"))
print(math.sqrt(n))'''

#4.Write a program to calculate the area of a rectangle given the length and
breadth are 50 and 20 respectively.
'''length = 50
breadth = 20
area=length*breadth
print("area of a rectangle is",area)'''

#5.Write a program to read name and marks of a student and display the total marks.
'''name=input("enter student name")
it=int(input("enter IT marks"))
ai=int(input("enter artifitial intelligence marks"))
cs=int(input("enter computer science marks"))
tot=cs+ai+it
print("name of the studnet", name)
print("total marks of the student",tot)'''
#6.Write a program to display even numbers between 10 and 20.
'''for i in range(10,21,2):
print(i)'''
#7.Write a python program to check whether the given number is even or odd.
'''n=int(input("enter a number"))
if n%2==0:
print(n,"is even number")
else:
print(n,"is odd number")'''
#8.Write a python program to create a user defined list.
'''l=[]
n=int(input("enter how many elements"))
for i in range(1,n+1):
ele=int(input("enter element to add in the list"))
l.append(ele)
print(l)'''
#9.9.Write a python program to create a user defined dictionary
'''d={}
n=int(input("how many values"))
for i in range(1,n+1):
key=int(input("enter roll number"))
value=input("enter name")
d[key]=value
print(d)'''
#10.Write a python program to create a CSV file.
f=open("sample.csv","w")
f.write("I am learning python csv files")
f.close()

You might also like