+ 2

Fraction input?

I have created a code to solve sequence and series like questions. But I needed to have fraction as input . How to solve this problem? Reply if anybody know about this issue.

25th Dec 2023, 10:37 AM
♦️NɨɍmȺł ꝁɍ VɨmȺł ♦️
♦️NɨɍmȺł ꝁɍ VɨmȺł ♦️ - avatar
2 odpowiedzi
+ 2
assuming it is Python, you can use the fraction module https://docs.python.org/3/library/fractions.html from fractions import Fraction #sample input : 1/2 myfraction = Fraction(input()) print(myfraction) print(myfraction*2)
28th Dec 2023, 1:02 AM
Bob_Li
Bob_Li - avatar
+ 4
tag the relevant programming language. give an example. you can take multiple numbers as input.
25th Dec 2023, 12:13 PM
Lisa
Lisa - avatar