xxxxxxxxxx
>>> name = "Test"
>>> f"My app name is {name}."
'My app name is Test.'
xxxxxxxxxx
var price = 500;
var money = 100;
if (price > money) {
console.log("Not Enough")
} else {
console.log("Can Buy")
}
xxxxxxxxxx
#converting weight into pounds orkilograms.
given_weight=int(input('given_weight'))
unit=input('(K)G or (L)bs')
if unit.upper() == 'K':
pounds=given_weight/0.45
print('weight in pounds',pounds)
else:
kilograms=given_weight*0.45
print('weight in kg',kilograms)
________________________________________________________________________________
xxxxxxxxxx
if( name = 'george washington'):
print("You have the same name as the first president of the United States")
// python
else:
print("You do not have the same name as George Washington")
xxxxxxxxxx
if(Boolean_expression) {
// Statements will execute if the Boolean expression is true
}
xxxxxxxxxx
if(Boolean_expression) {
// Statements will execute if the Boolean expression is true
}
If the Boolean expression evaluates to true then the block of code inside the if statement will be executed. If not, the first set of code after the end of the if statement (after the closing curly brace) will be executed.
xxxxxxxxxx
if( ID = josh ):
print("ID confirmed")
// python
else:
print("ID does not exist")