Skip to content

bmegha98/Python-Practice

Repository files navigation

Python-Practice

  • Jadoo, the space alien has challenged Koba to a friendly duel. He asks Koba to write a program to print out all numbers from 70 to 80. Knowing perfectly well how easy the problem is, the Jadoo adds his own twist to the challenge. He asks Koba to write the program without using a single number in his program and also restricts the character limit to 100.

  • Jadoo hates numbers, but he requires to print a special number "420" to recharge the equation of life. He asks your help to print the number but Since he hates numbers, he asks you to write the program such that there would not be any number in the code.

  • Jadoo, the Space Alien has befriended Koba upon landing on Earth. Since then, he wishes Koba to be more like him. In order to do so he decides to slowly transcribe Koba's DNA into RNA. But he has to write a very short code in order to do the transcription so as not to make Koba aware of the change. The four nucleotides found in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T). The four nucleotides found in RNA are adenine (A), cytosine (C), guanine (G) and uracil (U). Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement: * G --> C * C --> G * T --> A * A --> U

  • You are given the year, and you have to write a function to check if the year is leap or not.

  • You have to print a list of all possible coordinates given by (i,j,k) on a 3D grid where the sum of i+j+k is not equal to N.

  • Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up. --Input--: The first line contains n. The second line contains an array A[] of n integers each separated by a space. --Output--: Print the runner-up score.

  • Given the names and grades for each student in a Physics class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade. If there are multiple students with the same grade, order their names alphabetically and print each name on a new line.

  • You have a record of N students. Each record contains the student's name, and their percent marks in Maths, Physics and Chemistry. The marks can be floating values. The user enters some integer N followed by the names and marks for N students. You are required to save the record in a dictionary data type. The user then enters a student's name. Output the average percentage marks obtained by that student, correct to two decimal places.

  • Given a full name, your task is to capitalize the name appropriately.In a word only the first character is capitalized. Example 12abc when capitalized remains 12abc.

  • Consider a list (list = []). You can perform the following commands:

insert i e: Insert integer e  at position i.
print: Print the list.
remove e: Delete the first occurrence of integer e .
append e: Insert integer e at the end of the list.
sort: Sort the list.
pop: Pop the last element from the list.
reverse: Reverse the list.

Initialize your list and read in the value of n followed by n lines of commands where each command will be of the 7 types listed above. Iterate through each command in order and perform the corresponding operation on your list.

  • The first line contains the first name, and the second line contains the last name.Your task is to read them and print the following:
Hello firstname lastname! You just delved into python.
  • Read a given string, change the character at a given index and then print the modified string.
  • In this challenge, the user enters a string and a substring. You have to print the number of times that the substring occurs in the given string.
  • You are given a string S .Your task is to find out if the string S contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters.
  • You are given a partial code that is used for generating the HackerRank Logo of variable thickness. Your task is to replace the blank (______) with rjust, ljust or center.
  • You are given a string S and width w. Your task is to wrap the string into a paragraph of width w.
  • Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications:
Mat size must be N X M. ( N is an odd natural number, and M is 3 times N .)
The design should have 'WELCOME' written in the center.
The design pattern should only use |, . and - characters.
  • You are given an integer,N . Your task is to print an alphabet rangoli of size N. Different sizes of alphabet rangoli are shown below:
#size 3
----c----
--c-b-c--
c-b-a-b-c
--c-b-c--
----c----
  • Kevin and Stuart want to play the 'The Minion Game'.
Game Rules =:

Both players are given the same string,S .
Both players have to make substrings using the letters of the string S.
Stuart has to make words starting with consonants.
Kevin has to make words starting with vowels. 
The game ends when both players have made all possible substrings. 
A player gets +1 point for each occurrence of the substring in the string S.