Python Programming: Variables

35
halo dear suneet i your letter receive days ago about 2. i wait for you impatent. taday i go to park and had lots fun with new frends. i play minecraft every day while waiting for ur return. sending mi moust resent fotograf yours trully, Dobby the House Elf

Transcript of Python Programming: Variables

halo dear suneet!i your letter receive days ago about 2. i wait for you impatent. taday i go to park and had lots fun with new frends. i play minecraft

every day while waiting for ur return. sending mi moust resent fotograf!

yours trully,!Dobby the House Elf

Syntax

the arrangement of words and phrases to create well-formed sentences in a language.

Variables

my_name

my_name

my_name

=

=

=

“Leena”

“Spongebob”

100

Variable Assignment

my_name = Leena

dessert “cake”=

dessert 5=

dessert cake=

dessert cake=cake = “muffin”

greeting “Hello!”=

rohins_age 10=

ice_cream_price 2.50=

number_of_pets 2 + 4=

number_of_pets 3*2+4=

number_of_pets 3*(2+4)=

number_of_pets 3*(2+4)/2=

number_of_pets 3*((2+4)/2-1)=

koena = (3*2-1)/(2/2+2*2)-7

sam = 5ishaan = sam + 2

sam = 5

ishaan = sam + 2

Variable Names Can Contain:

Uppercase Letters: A B C D…

Lowercase Letters: a b c d…

Numbers: 1 2 3 4…

Underscore Symbol: _

*They can’t begin with a number

Which variable names are valid?

$my_favorite_animal

my best dress

_day_of_the_week

2_day_of_the_week

ROB123

HowAreYou

HowAreYou?

*Sahith

“Color”

String

String is Text

“I love you.”

“My name is Charles”

‘12345678910’

“hello 903, hey, howdy,hmm_$%#@”

String = Text

Tying Strings Together

“Hello!” “My name is Leena.”+

“Hello!” “My name is Leena.”+

“Hello!My name is Leena.”