Session 1 - Basic Inputs Flashcards
Basics – Inputs and Operations (15 cards)
Simple print (2mins)
Write a program that prints
Hello, Python!
A
User Input (2mins)
Ask the user for his name and print the name as below. The “Eran” should be changed as to whatever name the user has entered.
Input: Eran
Output:
Hello, Eran!
A
Sum (2mins)
Ask the user for two numbers and print their sum.
Input 1: 15
Input 2: 5
Output:
The sum is: 20
Difference (2mins)
Ask the user for two numbers and print their difference.
Input 1: 2
Input 2: 4
Output:
The difference is: -2
A
Product (2mins)
Ask the user for two numbers and print their product.
Input 1: 2
Input 2: 4
Output:
The product is: 8
A
Quotient (2mins)
Ask the user for two numbers and print their quotient.
Input 1: 10
Input 2: 2
Output:
The quotient is: 5
A
Basic Math (2mins)
Ask the user for three numbers. The first number should be added to the second number. The sum of the two numbers should then be multiplied to the third number
Input 1: 2
Input 2: 4
Input 3: 6
Output:
The answer is: 36
A
Odd or Even (2mins)
Ask the user for two numbers. Get the sum of the two numbers then check whether the sum is odd or even.
Input 1: 6
Input 2: 5
Output:
The sum is: odd
A
Ohm’s Law (2mins)
Ask the user for two numbers. The first number will be the resistance while the second number is the current. Print the voltage calculated.
Input 1: 10
Input 2: 5
Output:
The voltage is: 50
A
Positive, Negative, or Zero (2mins)
Ask the user for a number and print whether it’s positive, negative, or zero.
Input 1: Enter a number: -5
Output:
Negative number
A
Check Voting Eligibility (2mins)
Ask the user for age and check if they’re eligible to vote (18+).
Input 1: Enter your age: 16
Output:
Not eligible to vote
A
Find the Largest of Two Numbers (2mins)
Compare two numbers and print which one is larger.
Input 1: Enter first number: 12
Input 2: Enter second number: 7
Output:
12 is larger
A
Grade Checker (2mins)
Ask the user for a mark (0–100) and print the grade.
Grading Rules:
* A: 90–100
* B: 80–89
* C: 70–79
* D: 60–69
* F: Below 60
Input 1: Enter your mark: 82
Output:
Grade: B
A
Matrix Sum (4mins)
Ask the user for two sets of numbers separated by spaces then print the matrix sum of those numbers.
Input 1: 2 5 15 10 12
Input 2: 4 -7 6 11 -2
Output:
6 -2 21 21 10
A
Matrix Difference (4mins)
Ask the user for two sets of numbers separated by spaces then print the matrix difference of those numbers.
Input 1: 2 5 15 10 12
Input 2: 4 -7 6 11 -2
Output:
-2 12 9 -1 14
A