Class IX Python String Chapter Notes
Class IX Python String Chapter Notes
2.Concatenation Output:
str1=’hello’ hello w0rld
str2="world" hellow0rld
str3=str1+' '+str2
print(str3)
str4=str1+str2
print(str4)
st=['this','will','join', 'all','the','words']
print('#'.join(['this','will','join',
'all','the','words'])) this#will#join#all#the#words
st=['this','will','join', 'all','the','words']
print(' '.join(['this','will','join', this will join all the words
'all','the','words']))
st=['this','will','join', 'all','the','words']
print(join(['this','will','join',
'all','the','words']))
str1="hello" Output:
print(str1*10) hellohellohellohellohellohellohellohellohellohello
new_var=3**4
print(new_var)
new_var=3^4
print(new_var)
I. One Word:
1. How do you combine two strings?
Ans: String1 +String2
2. Which of the following is defined variable is a string?
cool_variable_1=23.18
cool_variable_2=9
cool_variable_3=”Important Message”
cool_variable_4=14**3