Thursday, April 14, 2016

30 Days of Code Challenges : (Day 3) Intro to Conditional Statements

--------------------------------------------------------------------
#!/bin/python

import sys


n = int(raw_input().strip())
if n%2!=0:
    print "Weird"
elif n>=2 and n<=5:
    print "Not Weird"
elif n>=6 and n<=20:
    print "Weird"
elif n>20:
    print "Not Weird"
--------------------------------------------------------------------

30 Days of Code Challenges : (Day 2) Operators

--------------------------------------------------------------------
# Enter your code here. Read input from STDIN. Print output to STDOUT
import math
metal_cost=float(input())
tip=int(input())
tax=int(input())
tip=metal_cost*tip/100
tax=metal_cost*tax/100
total=metal_cost+tip+tax
total=round(total)
print "The total meal cost is %d dollars." % total
--------------------------------------------------------------------

30 Days of Code Challenges : (Day 1) Data Types

--------------------------------------------------------------------
i = 4
d = 4.0
s = 'HackerRank '
.........................................
k=int(input())
u=float(input())
l=raw_input()
print k+i
print u+d
print s+l
--------------------------------------------------------------------

30 Days of Code Challenges : (Day 0) Hello, World.

--------------------------------------------------------------------
inputString = raw_input() # get a line of input from stdin and save it to our variable

# Your first line of output goes here
print 'Hello, World.'
print inputString

# Write the second line of output
--------------------------------------------------------------------

Two Sum

Given an array of integers, return indices of the two numbers such that they add up to specific target. You may assume that each input w...