“Nicelık vs nitelık” üzerine

Jeff Atwood 2008 yılında Quantity Always Trumps Quality yazmış, ben yeni gördüm, bu da bizim ayıbımız olsun.

Yazıda alıntı yaptığı kısmı şu şekilde özetleyebilirim;

Bir seramik öğretmeni okulun ilk gününde sınıfı iki gruba ayırdığını duyurur. Sınıfın sol tarafındakilerin tümü, yalnızca ürettikleri işin miktarına göre derecelendirileceğini, sağdakilerin ise yalnızca kalitesine göre derecelendirileceğini söyler. Yaptığı prosedür basit; günün sonunda, tartıyı getirerek sol taraftaki gruptan 50 kiloluk “A” kalitede ve 40 kiloluk “B” vb. devam eden kalitede ürün çıkartılması beklenirken, sağ taraftaki gruptan sadece 1 kiloluk “kaliteli” ürün ürün çıkartılması beklenmiş.

Değerlendirme zamanı gelir ve ilginç bir sonuç ortaya çıkar; en yüksek kalitede eserlerin tümü, miktar açısından derecelendirilen grup (sol taraftaki) tarafından üretilir. Görünüşe göre, “nicelik” grubu yığınlar halinde iş yapmakla ve hatalarından ders alırken, “nitelik” grubu “mükemmellik” hakkında teoriler üretmekle meşguldü.

Yani, yaptığınız ve üzerinde uzun süre düşündüğünüz tasarım ve teorilere istinaden, bu harcanan zamanın bir şeyleri “geliştirmek,” üzerine daha iyi harcanabileceğidir. Buradaki temel düşünce, erken şekilde başarısızlık için harcadığınız zaman, “doğru şekilde yapmaya çalıştığınız” her şeyi öğrenmek için harcadığınız zamandır. Bu, “yanlış” şeyi geliştirmek için zaman harcayarak elde edemeyeceğiniz bir fayda. Bu orijinal ya da yeni bir fikir değil tabi ki. İşin güzel tarafı, Jeff Atwood burada çömlek yapmaktan yazılım geliştirmeye, veya blog yazısı yazmak için gerekli disiplinler için nasıl geçerli olduğunu açıklamış.

Bu tavsiyeyi değerli kılan, bize hata yapmaktan “korkmamayı” öğretmesi. Sadece bu değil, hatalarımızı “kabul etmeyi” de öğrenebiliriz çünkü sonuçta bu şekilde gerçekten “öğreniriz”. Eğer bir şey durgunlaşmışsa, – bu bir yazılım geliştirmesi de olabilir, kişisel bir ilişki de- bu durgunluktan çıkmak için rastgele bir şey yapmanın hiç bir şey yapmamaktan daha iyi olabileceğini düşünüyorum. Bunu yaparsanız, sonuçları analiz edebilir ve neyi “düzeltmemiz” gerektiğini anlayabiliriz.

Hackerrank “30 Days of Code” Çözümleri – Day 6: Let’s Review

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 6: Let’s Review” sorusunun açıklaması ve çözümü. Bu soruda size verilen bir string‘in çift ve tek index’teki karakterlerini ayrı ayrı yazdırmanız isteniyor.

► Hackerrank 30 Days of Code Çözümleri – Day 6: Let’s Review: https://www.hackerrank.com/challenges/30-review-loop/problem

► Problem açıklaması:

Objective

Today we will expand our knowledge of strings, combining it with what we have already learned about loops. Check out the Tutorial tab for learning materials and an instructional video.

Task

Given a string, S, of length N that is indexed from 0 to N – 1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).

Note: 0 is considered to be an even index.

Example

s = adbecf

Print abc def

Input Format

The first line contains an integer, T (the number of test cases).

Each line i of the T subsequent lines contain a string, S.

Output Format

For each String (where ), print ‘s even-indexed characters, followed by a space, followed by ‘s odd-indexed characters.

Sample Input

2

Hacker

Rank

Sample Output

Hce akr

Rn ak

Hackerrank “30 Days of Code” Çözümleri – Day 5: Loops

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 5: Loops” sorusunun açıklaması ve çözümü. Bu soruda loop (döngü) mantığını ve her bir döngüdeki değişkenleri nasıl kullanabileceğimizi öğrendik.

► Hackerrank 30 Days of Code Çözümleri – Day 5: Loops: https://www.hackerrank.com/challenges/30-loops/problem

► Problem açıklaması:

Objective

In this challenge, we will use loops to do some math. Check out the Tutorial tab to learn more.

Task

Given an integer, n, print its first 10 multiples. Each multiple n x i should be printed on a new line in the form: n x i = result.

Example

The printout should look like this:

3 x 1 = 3

3 x 2 = 6

3 x 3 = 9

3 x 4 = 12

3 x 5 = 15

3 x 6 = 18

3 x 7 = 21

3 x 8 = 24

3 x 9 = 27

3 x 10 = 30

Input Format

A single integer, n.

Constraints

Output Format

Print 10 lines of output; each line i (where 1 lessEqual i lessEqual 10) contains the result of n x i in the form:

n x i = result.

Sample Input

2

Sample Output

2 x 1 = 2

2 x 2 = 4

2 x 3 = 6

2 x 4 = 8

2 x 5 = 10

2 x 6 = 12

2 x 7 = 14

2 x 8 = 16

2 x 9 = 18

2 x 10 = 20

Hackerrank “30 Days of Code” Çözümleri – Day 4: Class vs. Instance

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 4: Class vs. Instance” sorusunun açıklaması ve çözümü. Bu soruda sınıf ve field’lar üzerinde işlemler yapıyoruz.

► Hackerrank 30 Days of Code Çözümleri – Day 4: Class vs. Instance: https://www.hackerrank.com/challenges/30-class-vs-instance/problem

► Problem açıklaması:

Objective

In this challenge, we’re going to learn about the difference between a class and an instance; because this is an Object Oriented concept, it’s only enabled in certain languages. Check out the Tutorial tab for learning materials and an instructional video!

Task

Write a Person class with an instance variable, age, and a constructor that takes an integer, initialAge, as a parameter. The constructor must assign initialAge to age after confirming the argument passed as initialAge is not negative; if a negative argument is passed as initialAge, the constructor should set age to 0 and print Age is not valid, setting age to 0.. In addition, you must write the following instance methods:

yearPasses() should increase the age instance variable by 1.

amIOld() should perform the following conditional actions:

If age less than 13, print You are young..

If age bigger or equal than 13 and age less than 18, print You are a teenager..

Otherwise, print You are old..

To help you learn by example and complete this challenge, much of the code is provided for you, but you’ll be writing everything in the future. The code that creates each instance of your Person class is in the main method. Don’t worry if you don’t understand it all quite yet!

Note: Do not remove or alter the stub code in the editor.

Input Format

Input is handled for you by the stub code in the editor.

The first line contains an integer, T (the number of test cases), and the T subsequent lines each contain an integer denoting the age of a Person instance.

Constraints

Output Format

Complete the method definitions provided in the editor so they meet the specifications outlined above; the code to test your work is already in the editor. If your methods are implemented correctly, each test case will print or lines (depending on whether or not a valid was passed to the constructor).

Sample Input

4

-1

10

16

18

Sample Output

Age is not valid, setting age to 0.

You are young.

You are young.

You are young.

You are a teenager.

You are a teenager.

You are old.

You are old.

You are old.

The extra line at the end of the output is supposed to be there and is trimmed before being compared against the test case’s expected output. If you’re failing this challenge, check your logic and review your print statements for spelling errors.

Hackerrank “30 Days of Code” Çözümleri – Day 3: Intro to Conditional Statements

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 3: Intro to Conditional Statements” sorusunun açıklaması ve çözümü. Bu soruda karşılaştırma operatörlerine giriş yapıyoruz.

► Hackerrank 30 Days of Code Çözümleri – Day 3: Intro to Conditional Statements: https://www.hackerrank.com/challenges/30-conditional-statements/problem

► Problem açıklaması:

Objective

In this challenge, we learn about conditional statements. Check out the Tutorial tab for learning materials and an instructional video.

Task

Given an integer, n, perform the following conditional actions:

If n is odd, print Weird

If n is even and in the inclusive range of 2 to 5, print Not Weird

If n is even and in the inclusive range of 6 to 20, print Weird

If n is even and greater than 20, print Not Weird

Complete the stub code provided in your editor to print whether or not n is weird.

Input Format

A single line containing a positive integer, n.

Output Format

Print Weird if the number is weird; otherwise, print Not Weird.

Sample Input 0

3

Sample Output 0

Weird

Sample Input 1

24

Sample Output 1

Not Weird

Explanation

Sample Case 0: n = 3

n is odd and odd numbers are weird, so we print Weird.

Sample Case 1: n = 24

n biggerThan 20 and is even, so it is not weird. Thus, we print Not Weird.

Hackerrank “30 Days of Code” Çözümleri – Day 2: Operators

Hackerrank‘in 30 Days of Code içerisinde bulunan “Day 2: Operators” sorusunun açıklaması ve çözümü. Bu soruda size verilen yemek ücreti, bahşiş ve vergi yüzdeleri ile birlikte toplamda ne kadar para ödemeniz gerektiğinizi bulmanız isteniyor.

► Hackerrank 30 Days of Code Çözümleri – Day 2: Operators: https://www.hackerrank.com/challenges/30-operators/problem

► Problem açıklaması:

Objective

In this challenge, you will work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video.

Task

Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost. Round the result to the nearest integer.

Example

mealCost = 100

tipPercent = 15

taxPercent = 8

A tip of 15% * 100 = 15, and the taxes are 8% * 100 = 8. Print the value 123 and return from the function.

Function Description

Complete the solve function in the editor below.

solve has the following parameters:

int meal_cost: the cost of food before tip and tax

int tip_percent: the tip percentage

int tax_percent: the tax percentage

Returns The function returns nothing. Print the calculated value, rounded to the nearest integer.

Note: Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result.

Input Format

There are 3 lines of numeric input:

The first line has a double, mealCost (the cost of the meal before tax and tip).

The second line has an integer, tipPercent (the percentage of mealCost being added as tip).

The third line has an integer, taxPercent (the percentage of mealCost being added as tax).

Sample Input

12.00

20

8

Sample Output

15