"""
import math
print math.sqrt(30)
print math.sqrt(123)
print math.sqrt(80)
from math import sqrt
print sqrt(21)
print sqrt(90)
print sqrt(70)
"""
#Take vacation project
def hotel_cost(nights):
return nights*90
def bus_ticket_cost(city):
if city=="buchanan":
return 245
elif city=="kakata":
return 180
elif city=="zwedru":
return 742
elif city=="happer":
return 1230
def rental_bike_cost(days):
per_day=days*40
if days>3:
return per_day-20
elif days>=7:
return per_day-50
else:
return per_day
def trip_cost(city,days,spending_money):
return rental_bike_cost(days)+hotel_cost(days)+bus_ticket_cost(city)+spending_money
print trip_cost("zwedru",5, 200)
Friday, 30 August 2013
Intermediate
# intermediate python day 1: General Review
#q4
water="fishman"
print water
rate=79.5
print rate
pan=10+10
print pan
box=12<6
print box
#q5
print len('electrification')
#q6
business=raw_input("what is your name")
print "hello%s you i welcome to my home' % busines"
#q7
LIB_weather=raw_input("what is the weather ?")
weather_R="dry season"
weather_S="rainy season"
if LIB_weather==weather_R:
print" you need umbrella"
elif LIB_weather==weather_S:
print "yes need a umbrella n Tshirt"
else:
print "this weather is in LIB"
#q8
print not not not false
#q9
print 510+12!=600-78
#q10
print"personification"[7]
#q11
print "freedom".upper()
#q12
from datetime inputdatetime
current_datetime=date.now()
"""
#q4
water="fishman"
print water
rate=79.5
print rate
pan=10+10
print pan
box=12<6
print box
#q5
print len('electrification')
#q6
business=raw_input("what is your name")
print "hello%s you i welcome to my home' % busines"
#q7
LIB_weather=raw_input("what is the weather ?")
weather_R="dry season"
weather_S="rainy season"
if LIB_weather==weather_R:
print" you need umbrella"
elif LIB_weather==weather_S:
print "yes need a umbrella n Tshirt"
else:
print "this weather is in LIB"
#q8
print not not not false
#q9
print 510+12!=600-78
#q10
print"personification"[7]
#q11
print "freedom".upper()
#q12
from datetime inputdatetime
current_datetime=date.now()
"""
# this code will be squared number
def squared_num(z):
print z**2
squared_num(6)
#this fnctxn defining modulus
def draperc (b,d):
print b&d
draperc(31,5)
#generate run fnctxn it should 3arg
def math(E2,E3,E4):
print E2-E3-E4
math (100,90,80)
#4 creata function call transport
def transport(taxi,bike,canon):
print taxi+bike+canon
transport (12,11,3)
#5
def moving_on(x,y):
x=7
y=8
return x+y
print moving_on(7,8)
#
def moving_on(x,y):
return x+y
moving_here=moving_on(7,8)
print moving_here
def squared_num(z):
print z**2
squared_num(6)
#this fnctxn defining modulus
def draperc (b,d):
print b&d
draperc(31,5)
#generate run fnctxn it should 3arg
def math(E2,E3,E4):
print E2-E3-E4
math (100,90,80)
#4 creata function call transport
def transport(taxi,bike,canon):
print taxi+bike+canon
transport (12,11,3)
#5
def moving_on(x,y):
x=7
y=8
return x+y
print moving_on(7,8)
#
def moving_on(x,y):
return x+y
moving_here=moving_on(7,8)
print moving_here
Monday, 5 August 2013
Friday, 2 August 2013
working with comparetor in boolean
10==11-1
print 10==11-1
20==19+1
print 20==19+1
15==3*5
print 15==3*5
print 10==20/2
print 3!=8
print 25>7
print 2<8
print 2>=0
print 3<=6
print not not not False
print False and False
print -3==-3 and 5>=10
print 20<=-3 or False
print -10 or -10
100 or 100
print 3>7 or 5>15
print not 5*5<25
print not 8/2>4
print False or not True and True
print False and not True or True
print True and not (False or False)
print not not True or False and not True
print 10==11-1
20==19+1
print 20==19+1
15==3*5
print 15==3*5
print 10==20/2
print 3!=8
print 25>7
print 2<8
print 2>=0
print 3<=6
print not not not False
print False and False
print -3==-3 and 5>=10
print 20<=-3 or False
print -10 or -10
100 or 100
print 3>7 or 5>15
print not 5*5<25
print not 8/2>4
print False or not True and True
print False and not True or True
print True and not (False or False)
print not not True or False and not True
Subscribe to:
Posts (Atom)