Escolar Documentos
Profissional Documentos
Cultura Documentos
Symbol
==
Equal
- letter
!=
Not equal
>=
Valid name
<=
- _myStr
% (Madulo)
- numbers
- underscore _
- my3
Palindrome (cont)
print (user_word,
"is not a Palindrome")
Palindrome
Invalid name
- 3my=hi -- cannot start with
Area of Triangle
+ 1
def areaOfTriangle(base,
number
index = 0
- first name=hi
reverse = ''
- first-name
- first+name
len(user_word):
reverse =
user_word[index] +
(reverse)
index = int(index)
+ 1
if user_word ==
reverse:
return True
else:
return False
while True:
user_word =
input("Please enter a
len(mystr):
word: ")
if user_word ==
print
(mystr[letter_num])
letter_num =
letter_num + 1
"quit":
break
print("Length of the",
user_word, "is",
len(user_word))
Palindrome =
isPalindrome(user_word)
if Palindrome == True:
print (user_word,
"is a Palindrome!")
def isPalindrome(word):
word[index] + (reverse)
index = int(index)
hight) :
- Hello_there
reverse =
user_base =
float(input("Enter the
Combine that
string
string* string
CRASH!
float(input("Enter the
number *
Multiply (Math)
number
string ** string
CRASH!
triangle is",
number **
Exponent (Math)
areaOfTriangle(user_base,
number
user_height))
string **
def volumeOfPrism(area,
number
CRASH!
high) :
return area * high
user_prism_high =
Countdown Machine
number = int(input("What
float(input("Enter the
hight of the prism: "))
print ("The volume of the
prism is",
volumeOfPrism(areaOfTriang
le(user_base,
countdown_number =
countdown_string +
user_height),
user_prism_high))
number = number - 1
Reverse Word
print (countdown_string)
while True:
word = input("Please
enter a word")
index = 0
reverse = ' '
while int(index) <
len(word):
else:
By Mnasnan (mnasnan)
Sponsored by Readability-Score.com
cheatography.com/mnasnan/
Page 1 of 2.
https://readability-score.com
Create List
score = 0
def areaOfCircle(r):
print (guesslist)
pi = 3.1415
createList
' :
while chance != 0:
area = pi r * 2
argument: quitword
return area
return: a list
user_number = input
("Enter a number to
convert to binary")
number =
int(user_number)
binary_string = ' '
while (number > 0):
remainder =
number%2
random_item =
random.choice(guesslist)
user_input =
word: ")
radius =
if user_input ==
random_item:
print ("That's
str(remainder)+
binary_string
number = number//2
print ("Binary string
is", binary_string)
print ("Score:",
score)
fruits.append(user_fru
guesslist = ['grape',
areaOfCircle(radius))
item: ")
if user_word ==
quitword:
user_radius = input("What
return mylist
#returns the list and
exits the function
duplicateword =
radius =
False
float(user_radius)
for item in
pi = float(3.1415)
mylist:
area = pi (radius*2)
if user_word
== item:
ord = True
Function (Ex.)
if (duplicateword
Remaining:", chance)
print ("Sorry,
wrong choice!")
chance =
def myprint2(text,
== True):
chance - 1
print ("Chance
import random
duplicatew
if chance == 0:
Guess word game
user_word =
circle is",
chance - 1
Remaining:", chance)
fruit)
chance =
else:
it)
forever
circle?")
if user_input not
print ("Chance
fruit")
float(user_radius)
is a radius of a
else:
print ("Sorry,
Area of Circle
100
mylist = [] #empty
list
score = score +
in guesslist:
Sort fruit list
def createList(quitword):
input("Please guess a
correct!")
binary_string =
user_radius =
return
'orange', 'chloroplast',
+++++Hello+++++
'ribosome', 'lipstick']
-=-=-=-=Hello-=-=-=-=
chance = 3
<<<<<Hello<<<<<
mylist.append(
the list
myprint2("Hello", "-=-=-
"<<<<<")
score)
else:
"+++++")
myprint2("Hello",
("Duplicate Word!")
myprint2("Hello",
=-=")
userlist =
createList('stop')
#Function Call
print (userlist)
By Mnasnan (mnasnan)
Sponsored by Readability-Score.com
cheatography.com/mnasnan/
Page 2 of 2.
https://readability-score.com