def hourstominutes(minutes):
    hours = minutes/60
    return hours
h = int(input(print("Enter the number of minutes:")))
print(hourstominutes(h))
            Asked
            
        
        
            Active
            
        
            Viewed 63 times
        
    1
            
            
         
    
    
        Vitaliy Terziev
        
- 6,429
- 3
- 17
- 25
 
    
    
        Sanju Gautam
        
- 19
- 2
- 
                    6Why are you calling `print()` inside `input()`? The argument to `input()` is a string to print as the prompt. – Barmar Sep 24 '19 at 20:49
- 
                    What is the output that you're getting? – rassar Sep 24 '19 at 20:49
- 
                    4`input` takes a string and prints it to the screen then waits for input. `print` prints to the screen and doesn't return anything, that is, it returns `None`, which then `input` prints. Yes, input does 2 things instead of 1. – solarc Sep 24 '19 at 20:51
- 
                    Thanks @Barmar it's working fine now :) – Sanju Gautam Sep 24 '19 at 20:53
- 
                    Thanks everyone for the help. I understood the difference. – Sanju Gautam Sep 24 '19 at 20:55
2 Answers
4
            
            
        Because you are adding the function print() within your input code, which is creating a None first, followed by the user input. Here is the solution:
def hours_to_minutes(minutes):
    hours = minutes/60
    return hours
h = int(input("Enter the number of minutes: "))
print(hours_to_minutes(h))
Output:
Enter the number of minutes: 50
0.8333333333333334
 
    
    
        Error - Syntactical Remorse
        
- 7,468
- 4
- 24
- 45
 
    
    
        Celius Stingher
        
- 17,835
- 6
- 23
- 53
0
            
            
        Input is printing the result of print("Enter the number of minutes:", and print() returns None.  What you want is int(input("Enter the number of minutes:")) with no print().
 
    
    
        Aaron Bentley
        
- 1,332
- 8
- 14