0% found this document useful (0 votes)
32 views4 pages

Try It Yourself

The document contains examples of using basic Python print functions and string manipulation. It also covers working with lists, including creating, modifying, and printing lists with multiple elements.

Uploaded by

xiao6449
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views4 pages

Try It Yourself

The document contains examples of using basic Python print functions and string manipulation. It also covers working with lists, including creating, modifying, and printing lists with multiple elements.

Uploaded by

xiao6449
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Try it yourself

1.1 http://python.org/ open this and find something that might intrest me?

1.2 print(hello world), the error would be “hello world” is undefined, we can fix this by adding two
quotes, thus making it print(“hello world”), “hello world” should appear on screen.

1.3 idea bag, I’ve created an idea portfolio

2.1 simple message:

_message_= “Kevin is 13 but looks 30”


print(_message_)

2.2 simple message:

person_name = input(“what’s the person’s name”)


actual_age = input(“what’s the person’s actual age?”)
looks_age = input(“how old does the person look?”)
print(person_name + “ is ” + str(actual_age) + “ but looks ” + str(looks_age))

2.3 personal message:

person_name = input(“who’s the person you’re referring to?”)


print(“Hello ” + person_name + “, would you like to go out with me today?”)

2.4 name cases:

person_name = “Gae Kevin”


print(person_name.upper())
print(person_name.lower())
print(person_name.title())

2.5 famous quote:

famous_person = “top g”
famous_quote = “sword, haha I got sword”
print(famous_person.title() + “ once said, ” + “”” + famous_quote.title() + “””)

2.6 famous quote

famous_person = input(“who’s the person that said this quote?”)


famous_quote = input(“what did this famous person say?”)
print(famous_person.title() + “ once said,” + “”” + famous_quote.title() + “””)
# need to test white space later, tested and edited

2.7 stripping names:

name_strip = “ Leo”
name_strip.lstrip()

name_strip = “Leo “
name_strip.rstrip()

name_strip = “Leo “
name_strip.()
#I suppose it should work for left and right

2.8 number 8:

print(3 + 5)
print(2 * 4)
print(16 / 2)
print(10 - 2)

2.9 favorite number:


# I’m going to make things harder and create a fav number guess game instead

favourite_number = float(“what’s your favourite number from 1 to 100”)

# player 1 enters this part


# lemme fix this later after I learn to loop
guess = float(“what do you think player one’s fav number is?”)
if guess > favourite_number
print(“too big”)
if guess < favourite_number
print(“too small”)
if guess = favoutie_number
print(“correct”)

2.10 from now on I’ll develop a habit of adding comments


# see?

2.11 Zen if python:

import The Zen Of Python, and then I read on

3.1 Names:

list_of_names = [‘Kevin’, ‘Alice’, ‘Chris’, ‘Leo’, ‘Ryan’, ‘Sophia’, ‘Austin’]

3.2 greetings:

# we’re gonna use the list form above

print(list_of_names[0].title() + “you’re a really nice friend, i hope to see you again.”)

3.3 Your Own List:

my_own_list = [‘we’, ‘dont’, ‘talk’, ‘anymore’]


print(my_own_list)

3.4 guest list:

guest_list = [‘grandma’, ‘grandpa’, ‘brother’, ‘mom’, ‘dad’]


print(guest_list)
del guest_list[2]

guest_list.insert(0, ‘Joe’)

# or we could also use guest_list.append(‘Joe’)

3.5 Guest List Change:

print(guest_list)
guest_list.insert(0, ‘bob’)
guest_list.insert(3, ‘Dingo’)
guest_list.append(‘Ooku Looku’)

3.6

You might also like