-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday2_python.py
More file actions
46 lines (32 loc) · 924 Bytes
/
day2_python.py
File metadata and controls
46 lines (32 loc) · 924 Bytes
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
# Day 2 of days of 30 challenge
# What is variable?
#variable is a container that stores values
name = "hijabicoder"
age = 20
goal = "being a success full muslim"
print (name,age,goal)
print (name)
print (age)
print (goal)
# Method 1: Convert age to string using str()
print (name + str(age) + goal)
# Method 2: Use f-string (best practice!)
print(f"{name} {age} {goal}")
# Method 3: Use commas (automatically adds spaces)
print(name, age, goal)
print(f"my name is {name}, and i am {age} years old and my goal is {goal}!")
# Built in function
# type()function
print(type(name))
print(type(age))
print(type(goal))
my_name = input("Enter your name:")
print("hello my name is", my_name)
# 1st project
# create a complete bio using variables
first_name = "hijabicoder"
age = 20
city = "karachi"
hobby = "coding"
bio = f"my name is {first_name}, and my age is {age}, i live in {city},and i love {hobby}"
print(bio)