Input and Output Questions
print("Helloworld!") # Print out what's in the brackets question = "Give me a random number? " answer = input(question) # Stores results from input in the variable answer answer = float(answer) # turns answer into a float print(answer) # Prints out contents of answer
Print out your name.
Create a variable called fruit storing your favourite fruit. Print this variable out.
Create two variables a and b. Print out them added together.
Ask the user for their name. Print out their name.
Ask the user for an integer (round number). Print out 20 subtract this number.
Ask user for two numbers (floats). Tell user which one is bigger.
Ask user for two numbers. Print out the first divided by the second.
Ask user for a number. Tell the user if it's positive or negative.
Ask user for a number. Tell the user whether it's even or odd.
Tell the student their grade :
- Ask student for a number between 0 and 100.
- Tell use they score an A* if it's above 90
- Tell use they score an A if it's above 80
- Tell use they score an B if it's above 70
- Tell use they score an C if it's above 60
- Tell use they score an D if it's above 50
- else an F.
- tell student > 100 is not allowed.
Ask user for five numbers. Print out the sum of these numbers.
Many number calculator
- Ask user for how many numbers they would like to enter.
- Ask user for each number and store it.
- print out the min, max and sum of the numbers entered.
Tell user whether a sphere will float or sink.
- Ask user for the radius of a sphere. Calculate the volume
- Ask user for the mass of a sphere. Calculate the density of the sphere.
- If density is less than water it will float else sink. (density of water is $1000kg/m3$)