0

# Task - input: amount of students for three classes ; output: amount of required desks

import math

First_Class, Second_Class, Third_Class = input("Enter amount of students for each class : ").split(sep=",")
Amount_Of_Desks = math.ceil(int(First_Class) / 2) + math.ceil(int(Second_Class) / 2) + math.ceil(int(Third_Class) / 2)
print(f" Sum amount of required desks is : {Amount_Of_Desks}")

I wanna two separators in only one string

  • 2
    Does this answer your question? [Split string with multiple delimiters in Python](https://stackoverflow.com/questions/4998629/split-string-with-multiple-delimiters-in-python) – Mahrkeenerh Oct 17 '21 at 10:31

1 Answers1

0

You could convert the separators to one separator with replace function before calling split function

import math

First_Class, Second_Class, Third_Class = input("Enter amount of students for each class : ").replace(';',',').split(sep=",")
Amount_Of_Desks = math.ceil(int(First_Class) / 2) + math.ceil(int(Second_Class) / 2) + math.ceil(int(Third_Class) / 2)
print(f" Sum amount of required desks is : {Amount_Of_Desks}")