Skip to content

Commit 0fedd05

Browse files
committed
new questions are added
1 parent 2d8879b commit 0fedd05

File tree

8 files changed

+32
-16
lines changed

8 files changed

+32
-16
lines changed

Questions/AddIs.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
else:
66
print("is "+sValue)
77

8+

Questions/CalculateDate.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# 8. Write a Python program to calculate number of days between two dates. Sample dates : (2014, 7, 2), (2014, 7, 11).
2-
year = int(input("Enter year: "))
3-
month = int(input("Enter months: "))
4-
day = int(input("Enter day: "))
5-
6-
year2 =int(input("Enter second year: "))
7-
month2 =int(input("Enter second month: "))
8-
day2 =int(input("Enter second day: "))
9-
10-
year_day = ((year2-year)*12)*30 # we are assuming all month complete with 30 days
11-
month_day = ((month2-month))*30;
12-
day_day= (day2-day);
13-
14-
print(f'there fore all days are: {year_day+month_day+day_day}')
2+
import calendar
3+
from datetime import date
4+
d1=date(2014,7,2)
5+
d = date(2014,7,11)
6+
print((d-d1).days)

Questions/CalenderCalculation.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import calendar
22
from datetime import date
3-
yy = 2021;
4-
print(calendar.calendar(yy))
53
d1=date(2022,2,14)
64
d = date(2023,2,14)
75
print((d-d1).days)

Questions/CheckInput.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Write a Python program to input a number, if it is not a number generates an error message.
22
n = input("Enter a input: ")
3-
sN = int("r")
43
sN = n.isdigit()
54
if (sN):
65
print("Yes")

Questions/Q17.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
list = [10,20,5,7,30,80]
3+
a = 0;
4+
for i in list:
5+
if 8 == i:
6+
a = 1;
7+
else:
8+
a = 0;
9+
if a == 1:
10+
print("Value is present")
11+
else:
12+
print("Value is not present")

Questions/Q34.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
list = [5,8,10,9,7]
2+
for i in list:
3+
if i<9:
4+
print("In this list all all values are not garten than 9")
5+
break

Questions/Q49.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
list = [10,15,20,85,77]
2+
j = 0
3+
for i in list:
4+
j += i
5+
6+
print(j)

Questions/calender.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import calendar
2+
yy = int(input("Enter year: "))
3+
print(calendar.calendar(yy))

0 commit comments

Comments
 (0)