Decode School

Decode School - The School for Problem Solvers
Welcome to My Blog.
Need Assignment / Project Guidance (or) Training in Python?

Bytes to kilobytes in Python

Python program to get bytes b from user and find kilobytes kb

Sample Input 1:

2048

Sample Output 1:

2

Sample Input 2:

1024

Sample Output 2:

1

Program or Solution

					    
							
b=int(input("Enter Bytes:"))
kb=b/1024
print("{} Kilo Bytes".format(kb))

					    
					

Program Explanation

get bytes using input() method.

Calculate kilobyte = byte/1024 (1 kilo byte = 1024 bytes)