jeudi 21 novembre 2019

Why is it that an equation is different inside of a if statement, but not otherwise?

I'm trying to finish a tutorial question that I got on repl.it, but i'm stuck. Tutorial question 2.7, A car can cover distance of N kilometers per day. How many days will it take to cover a route of length M kilometers? The program gets two numbers: N and M.

N = int(input())
M = int(input())
NM = int(M / N)
# A day is N
if N > M:
  NMO = int(NM + 1)
  print(NMO)
else:
  print(NM)

I just cannot understand why it is what it is a different output from the same input

Input:

700
750

Intended output:

2

Actual output:

1

Aucun commentaire:

Enregistrer un commentaire