Skip to content

Commit 00519ac

Browse files
committed
updated programs
1 parent 84470c1 commit 00519ac

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Milestone 1/Conditionals and Loops/Calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
elif(i == 4):
3232
a = int(input())
3333
b = int(input())
34-
print(a/b)
34+
print(a//b)
3535
elif(i == 5):
3636
a = int(input())
3737
b = int(input())

Milestone 1/Conditionals and Loops/Fahrenheit to Celsius.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
E = int(input())
77
W = int(input())
88

9-
while E >= S:
9+
while S <= E:
1010
c = (5*(S-32))/9
1111
d = int(c)
1212
print(S, d)

Milestone 1/Conditionals and Loops/Nth Fibonacci Number.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
# F(2) = 1
66
# Provided N you have to find out the Nth Fibonacci Number.
77

8-
def fact(n):
8+
from math import *
9+
from collections import *
10+
from sys import *
11+
from os import *
12+
13+
## Read input as specified in the question.
14+
## Print output as specified in the question.
15+
def fib(n):
916
if n==1:
1017
return 1
1118
elif n==2:
@@ -16,10 +23,10 @@ def fact(n):
1623
b = 1
1724
while n-1 != 0:
1825
sum += a
19-
a = b
20-
b = sum
26+
a, b = b, sum
2127
n=n-1
2228
return sum
2329

2430
n = int(input())
25-
print(fact(n))
31+
print(fib(n))
32+

0 commit comments

Comments
 (0)