Skip to content

Commit 66847fb

Browse files
authored
Python Programming Exercise
1 parent c7dcdb1 commit 66847fb

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Q3.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Mon Aug 13 13:50:43 2018
4+
5+
@author: Ashutosh Verma
6+
"""
7+
8+
'''
9+
Question:
10+
With a given integral number n, write a program to generate a dictionary that contains (i, i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.
11+
'''
12+
13+
n=int(input())
14+
d=dict()
15+
for i in range(1,n+1):
16+
d[i]=i*i
17+
18+
print (d)

Q4.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Mon Aug 13 14:05:19 2018
4+
5+
@author: Ashutosh Verma
6+
"""
7+
8+
'''
9+
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number.
10+
'''
11+
12+
values=input()
13+
l=values.split(",")
14+
t=tuple(l)
15+
print (l)
16+
print (t)

0 commit comments

Comments
 (0)