Python - Beginner - Data Types 001
- Learner
- Dec 15, 2020
- 1 min read
Updated: Dec 30, 2020
Print one line
print("hello world")
print('Day 1 - Python Print Function')
print("the function is declared like this:")
print("print('what to print')")
Print across multiple lines
print("Hello world! \nHello world!")
print("Hello" +" "+ "Spark")
Include the # and then comment.
input("What is your name? ")
# capturing an input value
print(len(input("What is your name? ")))
#using len() to calculate the lenght
#The code is executed with the innermost bracket
being processed first.
name = input("What is your name dude? ")
print(name)
person_name = "Jack"
print(person_name)
person_name = "Missy Eliot"
print(person_name)
length = len(person_name)
print(length)
a = input("a: ")
b = input("b: ")
c = a
a = b
b = c
print("a: " + (a))
print("b: " + (b))
#objective was to swap the values between A and B.
Achieved by creating a new value C
Make the code readable and makes sense to you, so that you can recall this later. You can use a underscore e.g your_password. If you want to use numbers you cant use it at the start of the the variable name.
print("Welcome to the band name generator")
city = input("Which city did you grow up in?\\n")
pet = input("whats the name of your pet?\\n")
band_name = city +" " + pet
print("Your band name could be" + " " + band_name)

Comments