The first sentence of code
Hello World
Python3
Print ("HelloWorld")
Python2
Print " Hello World "
Linux
# ! /usr/bin/env pythonprint ("HelloWorld")
Variable
Variable refers to a value of a change
Variables can only consist of letters, numbers, underscores, and cannot start with a number
Python keyword cannot be variable
Name ==print(name,age)
Conditional statements
If Else
Name = input ("name:")if name = = Amada :Print( " Hello Amand " )else: pass
While loop
Count = 0 while Count <: print (count)= Count + 1
Homework
1. Use while loop input 1 2 3 4 5 6 8 9 10
Count = 1 while count < one: if count = =7 :pass else: Print(count) = count + 1
2. For all numbers of 1-100
s == 0 while Count <101: = s + count = count + 1 Print(count) print(s)
3. All odd numbers in output 1-100
Count = 1 while count < 101: = count% 2 if a = = 1 :print ( count) = Count +1
4. All even numbers in output 1-100
Count = 1 while count < 101: = count% 2 if a = = 0 :pri NT (count) = Count +1
5, Beg 1-2+3-4+5 ... 99 of all numbers of the and
s == 0 while C <100: = c% 2 if q = = 0 := S- c
Else: = s + c = c +1print(s)
6. User Login (three chance retry)
Count =0 whileCount < 3: Name= Input ("Account Number:") passwd= Input ("Password:") ifName = ="Ada" andpasswd = ="123": Print("Welcome to login") Break Else: Print("incorrect account or password") Count= Count + 1
Python full Stack Road "one" foundation