Python Forum
Simple exercise - how to write in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple exercise - how to write in python
#1
... just I'm really bad in math. Can anybody help me out?

Write a program to solve the following problem. At the beginning of the school year, the program manager has to split the students between the practical sessions. The manager wishes to divide the students between the classes as equally as possible. Write a program that asks the manager for the number of class rooms and for the number of students. The program should then output the number of students in each class room.

Test your program with the following inputs: number of students: 100, number of rooms: 20 number of students: 105, number of rooms: 10 number of students: 1050, number of rooms: 45

Some examples of the program output are shown below: Enter number of students: 103 Enter number of rooms: 15 In 13 classes there are 7 students In 2 classes there are 6 students
Reply
#2
(Sep-19-2017, 10:09 AM)tomtom55 Wrote: just I'm really bad in math.
For your example - 103 students in 15 classes :
15 goes into 103 6 times, with a remainder of 13 <- all the math you need
Reply
#3
Cool. I need python code for this
Reply
#4
(Sep-19-2017, 10:22 AM)tomtom55 Wrote: Cool. I need python code for this
Great, start coding :-) Because we are not going to do your homework for you. When you have some code, post it in code tags and ask specific questions. We will be glad to assist you in resolving specific issues.
Reply
#5
If you really must know, I cannot code, haven't done any math for decades.
My question is specific. What exactly here is confusing to you, I'll try and clarify it?
Reply
#6
There's nothing confusing here.
You want us to write code for you, and you're not showing any effort of your own.
We're here to help people learn, not do what looks like their homework for them.

If you're looking to hire someone to write code for you, post in the Jobs section, and maybe someone will come along to help in exchange for money, goods, or services.
Reply
#7
(Sep-19-2017, 11:06 AM)tomtom55 Wrote: If you really must know, I cannot code, haven't done any math for decades.

Me neither, but I write code all the time. Programming is mostly unrelated to math except in certain domains.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Exercise Vasanth0910 1 1,898 May-15-2020, 04:41 PM
Last Post: pyzyx3qwerty
  Python exercise HY2000 2 3,204 Nov-07-2019, 08:01 AM
Last Post: HY2000
Sad [Learning] 3 hours for one simple exercise KoFu 7 3,305 Sep-08-2019, 09:17 PM
Last Post: KoFu
  Python exercise janaraguz 2 2,570 Sep-22-2018, 08:43 PM
Last Post: ichabod801
  Python Exercise: Generate a two-dimensional array smbx33 4 10,829 Apr-22-2017, 11:51 PM
Last Post: smbx33

Forum Jump:

User Panel Messages

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