Skip to content

Commit ca5cbcd

Browse files
committed
add code
1 parent 47beb08 commit ca5cbcd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+45
-0
lines changed

Codes/24HourClock.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#Execute this through command prompt/ terminal using this command: python 24HourClock.py or python3 24HourClock.py
2+
3+
4+
#Python's input function always returns a string data which is assigned to variables currentTime and delayTime here.
5+
currentTime = input("What's the current time (24 Hours clock) ? ")
6+
delayTime = input("Alarm must ring after how many hours ? ")
7+
8+
#But to perform calculations we HAVE to convert string data into integer
9+
10+
#And that is done by writing
11+
# (int)(String_name)
12+
# Suppose a = "4"
13+
# Then if we write print(a+2) expecting it to print 6, but instead it prints 42. That's because It converts 2 to a string and then concatenates it to "4" which is a string.
14+
# Try to google these fancy words like concatenation and ofcourse we're always there for you.
15+
16+
#So what we do is to convert a from string to an int
17+
#that's done by a = (int)(a)
18+
# Now a = 4, quotes removed and string converted to int
19+
20+
#So that's why here we have written (int)(currentTime) and int(delayTime)
21+
waitTime = (int(currentTime) + (int(delayTime) % 24))%24
22+
print("Alarm time will be", waitTime, "hours.")

Codes/daysOfWeek.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
It is possible to name the days 0 through 6 where day 0 is Sunday and day 6 is Saturday. If you go on a wonderful holiday leaving on day number 3 (a Wednesday) and you return home after 10 nights. Write a general version of the program which asks for the starting day number, and the length of your stay, and it will tell you the number of day of the week you will return on.
3+
4+
"""
5+
6+
starting = input("Starting Day ?")
7+
lengthOfStay = input("Length of stay ?")
8+
9+
returnDay = (int(starting) % 7 + int(lengthOfStay)%7 ) % 7
10+
11+
print("Day of return", returnDay)

Codes/degreeAndFahreinheit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
degree =float(input("Enter degree = ?"))
2+
print("Fahreinheit", degree*(9/5) + 32)

Codes/print.py

Whitespace-only changes.

Codes/simpleInterest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
Compute final amount using formula of compound interest
3+
"""
4+
5+
principal =int( input("Principal Amount ? "))
6+
rate =int (input("Annual nominal interest rate ? "))
7+
compoundCount = int( input("Number of times the interest is compounded per year ? "))
8+
time = int(input("Number of years ?"))
9+
10+
print ("Amount = Rs", principal * ( (1 + rate/compoundCount)** (compoundCount * time)))

1.jpg renamed to Slides/1.jpg

File renamed without changes.

2.png renamed to Slides/2.png

File renamed without changes.

3.png renamed to Slides/3.png

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)