Getting User Input
In Python, you get user input using the raw_input() function:
- age = int(raw_input(“Enter your age: “))
- weight = float(raw_input(“Enter your weight: “))
- name = raw_input(“Enter your name: “))
In Java, getting user input is more complicated. We have provided a Helper class to simplify the process of getting user input. These are some of the methods that you will commonly use.
- int age = Helper.readInt(“Enter your age: “);
- double weight = Helper.readDouble(“Enter your weight: “);
- String name = Helper.readString(“Enter your name: “);
In python, the print() function is used to display result.
- print (“Hello World”)
In Java, you will need to use the following function to display result.
- System.out.println(“Hello World”);