Question: Write a Python program that: String printing and basic manipulation. At least one string that: prints a new line prints a tab uses the escape
Write a Python program that:
- String printing and basic manipulation. At least one string that:
- prints a new line
- prints a tab
- uses the escape character to print the single quote (') character.
- uses the escape character to print the double quote (") character.
- uses the escape character to print the backslash (\) character.
- uses multiple lines for one print function
- Data Types and Variables printing and basic manipulation.
- prints the result of a long integer operation
- prints a value in the following:
- decimal,
- octal,
- hex, and
- binary
- prints the lower-case a character in ASCII and Hex values of the "lower case a" character
- assigns values to variables a and b
- reassign the value of a to equal the value of b
- uses unary operators:
- positive for the variable a
- negative for the variable b
- uses basic use of:
- modulus (%)
- exponentiation (**)
1 # Sample Program #1 2 #printing a string with white space 3 print "Hello world! " 4 #printing the result of Long integer operation 5 print(123123123123123123123123123123123123123123123123 + 1) 6 #printing a value in decimal, octal, hex, and binary 7 print(10) 8 print(2010) 9 print(ex10) 10 print(@b10) 11 #using the escape character to print symbols in a string 12 print('This string contains a single quote (\) character.') 13 print("This string contains a double quote (\") character.") 14 #continuing a print of string in multiple lines 15 print('al 16 \ 17 18 #using the escape character and more white space 19 print('fool\bar') 20 print('foo\tbar') 21 #using the ASCII and Hex values of the "Lower case a" character 22 print("a\141\x61") 23 #assigning values to variables a = 4 25 b = 3 26 #reassigning a value to the variable a 27 a-b 28 #using unary operators 29 30-b 31 #using basic and not-50-simple math operators 32 print(a % b) 33 print(a ** b) 24 ta
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
