Python Forum

Full Version: Fraction Calculation with Limitations
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
numerator = input_number(f'Enter number {numerator_values}: ', numerator_values)
print(numerator)
(Dec-22-2020, 03:39 AM)bowlofred Wrote: [ -> ]print ('numerator') is not printing the variable numerator, it's printing the string "numerator". You would need to remove the quotes to reference the variable.

I removed the quotes and I get the whole list of possible numerator values 0 thru 15 not the number which was input.
(Dec-22-2020, 04:18 AM)deanhystad Wrote: [ -> ]numerator = input_number(f'Enter number {numerator_values}: ', numerator_values)
print(numerator)

Thank you that worked fine! Smile
On line 18 you ask for the value (via input) but instead of assigning it to a variable, it is just print()ed. Since it's not assigned, you don't have a record of it.

Assign it to a variable, and then you can print or do whatever.
Pages: 1 2