As a newbie programmer
As a newbie programmer

As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets


Using loops to draw patterns(Pyramid) @ Dcoder

8 Jul 2023 1 minute read 0 comments Lochard

Problem: Draw the pattern specified using loops. Input:  Output: The pattern as shown in sample output. First line contain 4 space and 1 star, next line contains 3 space and 3 stars and so on.. Constraints: Try not to hardcode the output. Sample Inpu...

They see me Palindroming @ Dcoder

7 Jul 2023 1 minute read 0 comments Lochard

Problem: In india there is a puzzle"5 characters my name, reverse- forward is the same." You will be presented with a 5 character String, you have to tell whether it satisfy above puzzle, if yes output "Yes" else "No" Input: Input is String S of 5 ch...

Toggle Me! @ Dcoder

6 Jul 2023 1 minute read 0 comments Lochard

Problem: Cody is very irritating child. He always change the characters in his homework, he has a trick. He change all small letter to capital and viceversa. His frinds gave him the title "The Toggle dude".One day his friends gave him some words, but...

The irritating Students @ Dcoder

5 Jul 2023 1 minute read 0 comments Lochard

Problem: Cody is Professor at Zing University. He teaches English there. During his first class, he found the students are very talkative. So,he decided to divide the class into two sections, A & B such that the difference between the strength of two...

Reverse me @ Dcoder

4 Jul 2023 1 minute read 0 comments Lochard

Problem: You are given an integer, reverse it. Input: Input contains an integer n. Output: Print reverse of integer. Constraints: 1≤n≤10000 Sample Input: 9956 Sample Output:  6599 print(input()[::-1].lstrip('0'))

The Predictor @ Dcoder

3 Jul 2023 1 minute read 0 comments Lochard

Problem: Cody always wanted to have some psychic powers so that he could showoff his skills, and magic to people and impress them, specially his girlfriend.But, in spite all his efforts, hardwork, dedication, Googling, watching youtube videos he coul...

I don't like Repetition @ Dcoder

2 Jul 2023 1 minute read 0 comments Lochard

Problem: The problem is simple, you are given a word. You need to remove the repeating characters. Input: Input contains a word w. Output: Print the output according to the problem explained. Constraints: 1≤w length≤100 Sample Input: AaabBbbc Sample...

Let's get GCD @ Dcoder

1 Jul 2023 1 minute read 0 comments Lochard

Problem: Cody was doing his maths homework, suddenly he found a GCD(Greatest Comman divisor) problem. He is very lazy to do all the calculations for this exercise, so he just took his mobile and opened the Dcoder App, decided to code a program to fin...

The closest to Average @ Dcoder

30 Jun 2023 1 minute read 0 comments Lochard

Problem: You are given an array, you have to find the closest integer to its average, look it has to be closest,not just the truncated version of the average. Input: First line contains n , number of elements of array, next line contains n integer se...

The Vowel Counter @ Dcoder

29 Jun 2023 1 minute read 0 comments Lochard

Problem: You are given with a String, you have to output count of vowels in the String. Input: Input contains a String. Output: Print vowel count in the String. Constraints: 1≤String lenght≤1000 Sample Input: Dcoder,A mobile coding platform Sample Ou...