-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfundamentals.py
More file actions
82 lines (31 loc) · 1.19 KB
/
fundamentals.py
File metadata and controls
82 lines (31 loc) · 1.19 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#using single and double quotes...
#string concatenation
print('What\'s up?')
#name of our variable is 'name' , with value 'jack'
name = "Jack"
age = 25
print('Example 1 : ', 'Hello World!', 'i am', type(name), 'my age is', type(age)) #calling the variable
print('Example 2 : ' + 'Hello World! ' + 'i am ' + name + 'my age is ' + str(age)) #using another way to print and using string concatenation
print(type(age))
#f string - formatted string
#clean code
name = "John"
print(f'Example 3: Hello World!, i am {name} my age is {age}')
print(f'Example 3.1: Hello World!, i am {name + 'ny'} my age is {age + 10}')
name = "John"
experience = 2.55555
projects = 10
#output
#folating point formatter
print(f'Example 3: Hello World!, i am {name} my age is {experience:.3f}')
#
this_is_my_long_variable = 'myvariable'
#Rules for creating variables
#Avoid using resereved keywords
#Use underscore for long chars
#using lowercase
#taking user input (making dynamic)
name = input('Name:')
experience = input('Your Experience?:')
# projects = input('How many projects have you done?:')
print(f'Example 3: Hello World!, i am {name} my experience is {experience} years')