0% found this document useful (0 votes)
3 views

Introduction - Python manual excercies loops

Uploaded by

stefanymca12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Introduction - Python manual excercies loops

Uploaded by

stefanymca12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Notes:

1. Interactive Interpreter Prompt:


- You can write code of python in command prompt.
print("Krunal Sukhwani")
- This function is used to print string in console.

2. Script file:
- You can create file with .py extension.
- python filename.py

Comments:
- Explain the code
- Only for developer's knowledge

syntax:
#comment

Variable (Identifier):
- Store value
- Refers to memory location in RAM
- Don't need to specify type of variable.
- Number - don't use double quotation sign
- String - double quotation

python:
age=18
price=19.99
name="krunal"

Note: Use Camelcase to declare variable.

Rules of variable:
- The first character of the variable must be an alphabet or underscore(_).
- All the characters except the first character may be an alphabet of lower-case(a-
z), upper-case (A-Z), underscore or digit (0-9).
- Identifier name must not contain any white-space, or special character (!, @, #,
%, ^, &, *).
- Identifier name must not be similar to any keyword defined in the language.
- Identifier names are case sensitive for example myname, and MyName is not the
same.

Variable Assignments:
#Assign single value to single variable
firstNumber = 20
print(firstNumber)

print string and integer value together: (concatenate value, join two values)
age = 20
print("alex's age: ",age)

price = 699.99
print("Apple Watch Series 7 Price: " , price)

#Assign single value to multiple variables


sandraAge=erickAge=gabiAge=20

print("Age: ",gabiAge)
#Assign multiple values to multiple variables
a,b,c=10,20.99,"hello"

print(c)

Example: Variable has same value then you can concate(join) two values.
firstName = "krunal"
lastName = "sukhwani"
name = firstName + lastName
print(name)

shoesPrice = 100
watchPrice = 299.99
total = shoesPrice + watchPrice
print(total)

Error:
productName = "ipad"
productPrice = 1299.99
productInfo = productName + productPrice
print(productInfo)

You might also like