Tripy 2.0
HOW IT WORKS
- Read the question here.
- Write and run code on your laptop.
- Raise your hand. A volunteer verifies and scores CC1 / CC2.
Checking which days are open…
E1 — Hello print
Print Hello, Tripy on the screen.
E2 — Two lines
Print your name on line 1 and your lab (CC1 or CC2) on line 2.
E3 — Name variable
Store your name in a variable and print it.
E4 — Echo input
Take a word as input and print it back.
E5 — Add two numbers
Take two numbers as input and print their sum.
E6 — Subtract
Take two numbers and print the first minus the second.
E7 — Multiply
Take two numbers and print their product.
E8 — Divide
Take two numbers and print a / b.
E9 — Floor division
Take two numbers and print how many full times b fits in a.
E10 — Remainder
Take two numbers and print the remainder of a divided by b.
E11 — Power
Take a and b and print a raised to b.
E12 — Precedence
Take a, b, c. Print a + b * c.
E13 — Brackets win
Take a, b, c. Print (a + b) * c.
E14 — Input type
Take any input and print its type.
E15 — To int
Take a decimal number as text and print it as an integer.
E16 — To float
Take a whole number and print it as a float.
E17 — Even or odd
Take a number and print even or odd.
E18 — Positive check
Print positive if the input is above 0, else print negative.
E19 — Pass mark
Print pass if marks are 40 or more, else fail.
E20 — Bigger of two
Take two numbers and print the bigger one.
M1 — Sign check
Print positive, negative, or zero for the input.
M2 — Add or sub menu
Take a choice (add or sub) plus two numbers, print the result.
M3 — Average of 3
Take 3 marks and print their average.
M4 — Celsius to F
Take Celsius and print Fahrenheit. F = C * 9/5 + 32.
M5 — Largest of 3
Take 3 numbers and print the largest.
M6 — Grade bands
Marks 90+ print A, 75+ print B, 60+ print C, 40+ print D, else F.
M7 — Divisible by 5 and 11
Print yes if the number divides by both 5 and 11, else no.
M8 — Vowel check
Take one letter and print vowel or consonant.
M9 — Teen check
Print teen if age is 13 to 19 inclusive, else not teen.
M10 — FizzBuzz lite
Print fizz if divisible by 3, buzz if by 5, fizzbuzz if by both, else the number.
M11 — Swap two
Take two numbers, swap them, print both on one line.
M12 — Minutes to sec
Take minutes and seconds, print total seconds.
M13 — Discount bill
Take price and discount percent, print the final price.
M14 — Day name
Take 1-7 and print Monday to Sunday. Anything else prints invalid.
M15 — Absolute value
Print the absolute value without using abs().
M16 — Triangle valid
Take 3 sides. Print valid if they form a triangle, else invalid.
M17 — Simple interest
Take principal, rate, years. Print interest = P*R*T/100.
M18 — Even and in range
Print yes if the number is even and between 10 and 99, else no.
M19 — Smallest of 3
Take 3 numbers and print the smallest.
M20 — Char or digit
Take one character. Print digit if 0-9, letter if a-z or A-Z, else other.
H1 — Full menu calc
Menu: add, sub, mul, div. Take choice + two numbers, print result. Div by zero prints cannot divide by zero.
H2 — Leap year
Print leap if the year is a leap year, else common.
H3 — Triangle type
Take 3 sides. Print invalid, equilateral, isosceles, or scalene.
H4 — Roots nature
Take a, b, c of ax^2+bx+c. Print real-equal, real-distinct, or imaginary from D = b*b-4ac.
H5 — Power bill slabs
First 100 units cost 3 each, next 100 cost 5 each, rest cost 8 each. Print the bill.
H6 — RPS winner
Two players enter rock, paper, or scissors. Print player1, player2, or draw.
H7 — ATM withdraw
Take balance and amount. Print new balance if amount is a multiple of 100 and within balance, else print denied.
H8 — Login check
Username must be admin and password tripy123. Print welcome or denied.
H9 — Seconds to h:m:s
Take total seconds, print hours minutes seconds.
H10 — Middle of 3
Take 3 different numbers and print the middle one.
H11 — 3-digit palindrome
Take a 3-digit number. Print yes if it reads the same backwards.
H12 — Armstrong 3-digit
Print armstrong if the number equals the sum of the cubes of its digits.
H13 — Gross salary
Basic <= 10000: HRA 20%, DA 80%. Else HRA 25%, DA 90%. Print gross = basic + HRA + DA.
H14 — Exam pass
Take 3 subject marks. Print pass if each is 40+ and average is 50+, else fail.
H15 — Sort 3 numbers
Take 3 numbers and print them in ascending order without sort().
H16 — Speed fine
Speed <= 60 prints ok, 61-80 prints fine 500, 81-100 prints fine 1000, above prints seized.
H17 — Voter + senior
Age < 18 prints minor, 18-59 prints voter, 60+ prints senior voter.
H18 — Digit sum vs product
Take a 2-digit number. Print sum-first if digit sum > digit product, else product-first.
H19 — Extended calc
Menu add, sub, mul, div, mod, pow. Guard div/mod by zero. Unknown op prints unknown.
H20 — Largest of 4
Take 4 numbers and print the largest without max().