-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe Basics.py
26 lines (26 loc) · 888 Bytes
/
The Basics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import time
print ('Welcome to The Basics!')
#time.sleep(1)
print ('Lets practice variables.')
#time.sleep(1)
print ('I will set \'age\' to 20 and \'price\' to 9.95, then print')
age = 20
price = 9.95
print (age)
print (price)
print ('Now lets get ur input')
name = input ('What is your name? ')
print ('Hey ' + name + '!')
print (type (name))
print (type (age))
course = 'Python for beginners' # this string is an object
print (course.upper()) # the function after the variable is called a method
# I like to think of it as manipulating an object
print (course.find('n')) # We can also set a parameter
print (course.replace('for', '4')) # We can also set MULTIPLE parameters
print ('for' in course) # Strings are immunitable so this will be true
number = int(input("Please enter a number: "))
if number % 2 == 0:
print("This is an even number.")
else:
print("This is an odd number.")