Python Forum
Calculate the multiple of a number
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate the multiple of a number
#7
(Mar-24-2020, 10:30 PM)pythonuser1 Wrote: I want to optimize it. I have these two lines print(i,r) and return(r ). Is there a way I can get rid of one of these two lines and yet have the correct output giving only the multiple of a number ?
# -*- coding: utf-8 -*-
# Les nombre multiples de n compris entre 1 et 60
def multiple(n):
    return int(60/n)

print(multiple(15))
Output:
4
Reply


Messages In This Thread
Calculate the multiple of a number - by pythonuser1 - Mar-24-2020, 10:30 PM
RE: Calculate the multiple of a number - by Fre3k - Mar-25-2020, 10:16 AM
RE: Calculate the multiple of a number - by ibreeden - Mar-27-2020, 09:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  calculate the 10001st prime number topologh 7 6,519 Oct-05-2020, 07:41 PM
Last Post: deanhystad
  Divide a number - Multiple levels - Sum of all numbers equal to input number pythoneer 17 9,267 Apr-20-2018, 04:07 AM
Last Post: pythoneer

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020