Skip to content
Sign UpLog In
Profile icon

Ahmad Enayat

@AhmadShaheerSha
Repls
Community
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
I am making a pig Latin translator but for it doesn't work like I want it to.
Hello there, I am trying to make a pig Latin translator. I am stuck in a part where I can't seem to make it work. So this is my code. def consonant(
AdoredFancyMention-1
Python
ch1ck3n
ch1ck3n
def consonant(word): index = 0 while word[index] not in["a", "e", "i", "o", "u"]: index = index + 1 return word[index:] + word[0:index] + "ay" def vowel(word): return word + "way" def main(): text = input("Please enter a word/sentence: ") splitText = text.split(" ") pigLatinText = "" for word in splitText: firstChar = word[0] if firstChar in ["a", "e", "i", "o", "u"]: pigLatinText += vowel(word) + " " else: pigLatinText += consonant(word) + " " pr2 years ago
CodingCactus
CodingCactus
There really is no need for that if statement3 years ago
UniqueOstrich18
UniqueOstrich18
Change line 23 and 24 to: main() There is no need for the if statement because the program is supposed to run the main() function anyways. If this was helpful, please mark it as the answer.3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
It has been a couple of days that I have been trying to make a pig Latin translator. Everything works fine but there is a tiny problem. I will assume
AdoredFancyMention
Python
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
So I am supposed to write a code that creates a program that takes a list of 8 strings and moves them back in the order by one place. The first item o
LOLMcman
LOLMcman
Try this: def new_list(list): list = list[1:] + list[0] for word in list: print(2*word) 3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
It is exercise 9.1 in think python. My teacher talked about making a file called words.txt. I didn't understand what he meant by that. fin = open('wo
think python exercise 9.1
Python
SixBeeps
SixBeeps
If he's asking you to make one, you need to create a file yourself. Make a new file by clicking the Add File at the top of the files pane and name it "words.txt"3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
Create a program that takes a given string, a position in the string, and a letter and uses them as arguments. The program should take the string, and
String properties
Python
bossotron13
bossotron13
Very simple, use the .replace command. String = input('what string: ').lower() Letterchange = input('change what letter: ').lower() Tochange = input('change %s to: ' % Letterchange).lower() String = String.replace(Letterchange, Tochange) print(String) `3 years ago
AhmadShaheerSha
AhmadShaheerSha
If you have any questions please let me know.3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
import turtle turtle.color("Green") turtle.fillcolor("Yellow") turtle.speed(9) def recursive_triangles(length,depth): turtle.shape("turtle") turtle.
AlexanderTarn
AlexanderTarn
after you are finished with the triangle code, just add the circle code at the end, or just do the function at the end3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
import turtle def drawing_circle(): bob.color("Green") bob.speed(1000) bob.shape("turtle") bob.circle(59) window = turtle.Screen() bob = turtle.Tu
ColePayneSexton
ColePayneSexton
You could make your turtle turtle.forward(100) Turtle.left(45) Turtle.Forward(100) Turtle.left(45) Turtle.forward(100) This is for non-right angle triangles2 years ago
Geocube101
Geocube101
I shall happily give you this function: def generatePolygon(rot=0, length=100, sideCount=3, speed=0, filled=False, output=True): t.showturtle() t.speed(speed) rot = int(rot) sideCount = int(sideCount) rotate(rot) c = 360 / sideCount if filled == True: t.begin_fill() for a in range(sideCount): t.forward(length) t.left(c) if filled == True: t.end_fill() t.hideturtle() if output == 1 or output == True: print("Generated Polygon with Side a Count of: " + str(3 years ago
AhmadShaheerSha
AhmadShaheerSha
shared a Post
3 years ago
So my teacher assigned this exercise for us to do. But I have been stuck on this for a couple of days now. This is the exercise. A number, a is a pow
LOLMcman
LOLMcman
You just need one if statement saying that if a is divisible by b and a/b is a power of b, then return true.3 years ago