Program Languages: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "=c o d i n g= ==Javascript & Jquery== <source lang=jquery> ${document}.ready{function {} { Type yorur code }); Same as ${function () { Type yorur code }); </source> <sou...")
 
Line 1: Line 1:
=c o d i n g=
==Javascript & Jquery==
==Javascript & Jquery==
<source lang=jquery>
<source lang=jquery>

Revision as of 12:38, 23 October 2018

Javascript & Jquery

${document}.ready{function {} {
	Type yorur code
});

Same as

${function () {
	Type yorur code

});
#Java
document.getElementById(blink).style.background = purple;

Same as

#Jquery 
$(“#blink).css(background, pink);
#Jquery
$(li).css(background, red);

Same as

#css
.li {
Background-color: red;
}

Python

print "ho?"
print ("hoi?")
print 'hello ' + 'Bohye'
print "this is" + " a good string"
print 'this is' + ' a good string'
  • Arithmetic
january_to_june_rainfall = 1.93 + 0.71 + 3.53 + 3.41 + 3.69 + 4.50
annual_rainfall = january_to_june_rainfall

july_rainfall = 1.05
annual_rainfall += july_rainfall

august_rainfall = 4.91
annual_rainfall += august_rainfall

september_rainfall = 5.16
annual_rainfall += september_rainfall

october_rainfall = 7.20
annual_rainfall += october_rainfall

november_rainfall = 5.06
annual_rainfall += november_rainfall

december_rainfall = 4.06
annual_rainfall += december_rainfall
print annual_rainfall
#integer
int=1

#e indicating the power of 10
# this evaluates to 150:
float4 = 1.5e2
  • How to know how much I spend for buying berries?
berries = 10
price_per_berries = 3.25

total_cost = berries * price_per_berries
print total_cost
  • Division
#to see the cucumbers per person
cucumbers = 100
num_people = 6

whole_cucumbers_per_person = cucumbers/num_people

print whole_cucumbers_per_person

#to see the remaining cucumbers
float_cucumbers_per_person = float(cucumbers)/num_people
print float_cucumbers_per_person
  • Multi-line Strings