A. Introduction:
Strings can be multiplied and added in Python, which is cool and convenient. Halloween is coming, the code below prints a basic pumpkin by using string multiplication.
s0= 2*'&'
s1="*"
s = s1*13
teeth = 'V'*6
teeth2 = 2*'^'
hollow = ' '
print(hollow*12 + s0)
print(hollow*11 + s0)
print(hollow*11 + s0)
print(hollow*6+s)
print(hollow*5+s1+hollow*13+s1)
print(hollow*4+s1+hollow*4+'Q'+hollow*5+'Q'+hollow*4+s1)
print(hollow*3+s1+hollow*17+s1)
print(hollow*2+s1+hollow*6+teeth+hollow*6+s1)
print(hollow*2+s1+hollow*8+teeth2+hollow*8+s1)
print(hollow*3+s1+hollow*16+s1)
print(hollow*4+s1+hollow*14+s1)
print(hollow*6+s)
B. Try to print your version of pumpkin, use the images below as an inspiration. You may use two different ways to print out the white spaces: 1) use string multiplication as shown in the code above; 2) use F-string left and right alignment to print the padding white spaces. You also need to use F-string to print out some statistics about pumpkin carvers. Be creative!
2nd pumpkin maker is me i made the happy pumpkin maker idk if i am logged in
there is nothing wrong with it i made it like that
s0=2*'&' s1='*' s = s1*10 teeth = 'V'*1 teeth2 = 1*'^' hollow = ' ' print (hollow*10 + s0) print (hollow*9 + s0) print (hollow*9 + s0) print (hollow*4 + s1*10) print (hollow*3 + s1*2 + hollow*8 + s1*2) print (hollow*2 + s1*1 + hollow*2 + 'O\\' + hollow*3 + '/O' +hollow*1 + s1*1) print (hollow*3 + s1*1 + hollow*10 + s1*1) print (hollow*3 + s1*1 + hollow*3 + teeth*3 + hollow*4 + s1*1) print (hollow*3 + s1*1 + hollow*3 + teeth2*3 + hollow*4 + s1*1) print (hollow*3 + s1*1 + hollow*10 + s1*1) print (hollow*4 + s1*1 + s1*7 + hollow*0 + s1*1)
#Variables stem = "||" side = "//" otherSide = "\\\\" bottom = "---------" eyes = "O" mouth1 = "\\ /" mouth2 = " \\ /" mouth3 = " \\ /" bottom3 = "-----" #Stem print(f'{stem:>17}') print(f'{stem:>17}') print(f'{stem:>17}') print(f'{bottom:>20}') #Pumpkin print(f'{side:>10} {otherSide:>12}') print(f'{side:>9} {otherSide:>14}') print(f'{side:>8} {eyes:>5} {eyes:>2}{otherSide:>7}') print(f'{side:>7} {otherSide:>18}') print(f'{stem:>6} {bottom:>12} {stem:>6}') print(f'{stem:>6} {mouth1:>13} {stem:>6}') print(f'{otherSide:>7} {mouth2:>11} {side:>6}') print(f'{otherSide:>8} {bottom3:>9} {side:>6}') print(f'{otherSide:>9} {side:>14}') print(f'{otherSide:>10} {side:>12}') print(f'{bottom:>20}')
hallow = ' ' print(f' &&') print(f' &&') print(f' &&') print(f' &&') print(hallow*7 + "&&&&&&&&&&&&") print(hallow*5 + "&&" + hallow*12 + "&&") print(hallow*3 + "&&" + hallow*16 + "&&") print(hallow*3 + "&&" + hallow*16 + "&&") print(hallow*3 + "&&" + hallow*16 + "&&") print(hallow*3 + "&&" + hallow*16 + "&&") print(hallow*3 + "&&" + hallow*16 + "&&") print(hallow*5 + "&&" + hallow*12 + "&&") print(hallow*7 + "&&&&&&&&&&&&") this is my code