-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecond.py
More file actions
24 lines (20 loc) · 750 Bytes
/
second.py
File metadata and controls
24 lines (20 loc) · 750 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
# Split function
names = 'anshuman, satya, shikha, dipkia'
print(names.split(','))
#List and dictionary type
userinfolist = ['anshu','29','male','gurgaon']
userinfodict = {'name': 'Anshu', 'age': 29}
# Formatting in python using .format
# My informatio
firstname = 'Anshuman'
lastname = 'Tiwari'
fullname = firstname + ' ' + lastname
age = 29
location = 'Gurgaon'
office = 'Sapient'
# This is used for formatting a string
# First way - Simple .format
myinfo = 'My information is -> Fullname: {}, Age: {}, Location: {}, Office: {}' .format(fullname, age, location, office)
print(myinfo) #This will print my information
#Second way -> Fstring
myinfo = f'My information is -> Fullname: {fullname}, Age: {age}, Location: {location}, Office: {office}'