473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

I want to draw a triangle made of letters where you input the height and letter

I want to write a code that will give me this

>>> drawLeftTriangle(5,'A')
A
AA
AAA
AAAA
AAAAA

can anyone help me
Feb 22 '13 #1
1 1972
bvdet
2,851 Expert Mod 2GB
Following is one way. I will leave it to you to create the function.
Expand|Select|Wrap|Line Numbers
  1. >>> x = 'A'
  2. >>> for i in range(5):
  3. ...     print x*(1+i)
  4. ...     
  5. A
  6. AA
  7. AAA
  8. AAAA
  9. AAAAA
  10. >>> 
Feb 22 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul Neave | last post by:
Please try this out on a PC and a Mac in IE: http://www.neave.com/test.php The boxes should be both the same height, and evenly spaced top and bottom above the text. Mac IE, for some reason,...
7
by: Micheal Artindale | last post by:
I am looking at creating list of letter combinations. letters a-h 6 letters per combination letter can repeat its self in the combination, but not next to its self and, a series of letter can...
5
by: Agnes | last post by:
In textbox, there is a property (character casing), However, in combox , any method/property to set it (as the user input the text, it is default to upper case ? Thanks a lot
1
by: tshad | last post by:
I have 2 objects - one an aspx textbox object and one an html Input object: <asp:TextBox ID="UserName" CssClass="top-links" style="height:10px" Columns="12" runat="server"/> <input...
3
by: manxie | last post by:
Dear All Readers, I'm supposed to create a program with a switch and using voids to execute number of codes, that includes finding sum, average, maximum, and minimum, please read my code:...
6
by: jackj | last post by:
Hi, I am first time C++ student and doing the usual tasks. This one is to create a triangle based on user input of how large (how many rows) and what symbol to use. I have managed to create a...
4
by: saaji74 | last post by:
Hi Do I get a readymade sales and invoice management software which includes following; i. tracks all the sales. ii. record of products from different suppliers. iii. sales analysis. iv....
10
by: harz | last post by:
Hi, I just want to know if is there any way in C to get only 1 input from user? Like, Enter a letter: a After inputting a, should be that I can't anymore type with other letters, only 1....
3
tpgames
by: tpgames | last post by:
I do not understand why this code does not work? It will show ????? for the word length, but will does not actually access the individual letters within the word list. I enter the vowels as guesses,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.